Color only element content - HTML CSS CSS Widget

HTML CSS examples for CSS Widget:Color

Description

Color only element content

Demo Code

ResultView the demo in separate window


<html>
 <head> 
  <style>

div {<!--   w  w  w  . j a v a  2  s .  c  om-->
   margin:0px auto;
   width:100%;
   height:50px;
   background-color:white;
   float:left;
   padding:10px;
   border:2px solid red;
   position: relative;
   z-index: 10;
}
div:after {
   background-color: grey;
   content: '';
   display: block;
   position: absolute;
   top: 10px;
   left: 10px;
   right: 10px;
   bottom: 10px;
   z-index: -1;
}

      </style> 
 </head> 
 <body> 
  <div>
    Some text or anything 
  </div>  
 </body>
</html>

Related Tutorials