Using css for background block & underline (100%) - HTML CSS CSS Property

HTML CSS examples for CSS Property:background

Description

Using css for background block & underline (100%)

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{<!--from  w w  w  .  ja  va 2s .co  m-->
   position:relative;
}
div{
   background-color:#FF7F27;
   display:inline-block;
}
div:after{
   position:absolute;
   display:block;
   content:'';
   width:100%;
   height:5px;
   background-color:inherit;
}


      </style> 
 </head> 
 <body> 
  <div style="my-custom-style">
    T E X T 
  </div>  
 </body>
</html>

Related Tutorials