Transparent background with body::after limited by the screen size - HTML CSS CSS Property

HTML CSS examples for CSS Property:background

Description

Transparent background with body::after limited by the screen size

Demo Code

ResultView the demo in separate window

<html>
 <head> 
  <meta name="viewport" content="width=device-width, initial-scale=1"> 
  <style id="compiled-css" type="text/css">

body {<!--   ww w . jav a2s . c om-->
   padding-top: 50px;
}
body::after {
   content: "";
   background: black;
   opacity: 0.5;
   top: 0;
   left: 0;
   bottom: 0;
   right: 0;
   position: fixed;
   z-index: -1;
}


      </style> 
 </head> 
 <body> 
  <p>Lorem ipsum dolor sit amet, consectetur adipisicing elit. Laborum itaque earum eaque mollitia blanditiis consectetur harum recusandae magni rem autem omnis, eveniet error ex rerum doloremque. Laboriosam reprehenderit, expedita ad.</p> 
  <p>Lorem ipsum dolor sit amet, consectetur adipisicing elit. Laborum itaque earum eaque mollitia blanditiis consectetur harum recusandae magni rem autem omnis, eveniet error ex rerum doloremque. Laboriosam reprehenderit, expedita ad.</p> 
  <p>Lorem ipsum dolor sit amet, consectetur adipisicing elit. Laborum itaque earum eaque mollitia blanditiis consectetur harum recusandae magni rem autem omnis, eveniet error ex rerum doloremque. Laboriosam reprehenderit, expedita ad.</p> 
  <p>Lorem ipsum dolor sit amet, consectetur adipisicing elit. Laborum itaque earum eaque mollitia blanditiis consectetur harum recusandae magni rem autem omnis, eveniet error ex rerum doloremque. Laboriosam reprehenderit, expedita ad.</p> 
  <p>Lorem ipsum dolor sit amet, consectetur adipisicing elit. Laborum itaque earum eaque mollitia blanditiis consectetur harum recusandae magni rem autem omnis, eveniet error ex rerum doloremque. Laboriosam reprehenderit, expedita ad.</p> 
  <p>Lorem ipsum dolor sit amet, consectetur adipisicing elit. Laborum itaque earum eaque mollitia blanditiis consectetur harum recusandae magni rem autem omnis, eveniet error ex rerum doloremque. Laboriosam reprehenderit, expedita ad.</p> 
  <p>Lorem ipsum dolor sit amet, consectetur adipisicing elit. Laborum itaque earum eaque mollitia blanditiis consectetur harum recusandae magni rem autem omnis, eveniet error ex rerum doloremque. Laboriosam reprehenderit, expedita ad.</p> 
  <p>Lorem ipsum dolor sit amet, consectetur adipisicing elit. Laborum itaque earum eaque mollitia blanditiis consectetur harum recusandae magni rem autem omnis, eveniet error ex rerum doloremque. Laboriosam reprehenderit, expedita ad.</p>  
 </body>
</html>

Related Tutorials