Use border and z-index to add line - HTML CSS CSS Widget

HTML CSS examples for CSS Widget:Border Style

Description

Use border and z-index to add line

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">

.thebox {<!--   ww w . j  a va  2 s .  c om-->
   background-color: white;
   color: black;
   padding-top: 30px;
   padding-bottom: 30px;
   z-index: 1;
}
.thebox h1 {
   text-align: center;
   background-color: #666;
   margin-right: 100px;
   margin-left: 100px;
   font-size: 16px;
   z-index: 10;
}
.thebox .theline {
   border-top: solid 1px black;
   width: 100%;
   height: 1px;
   top: 19%;
   z-index: 5;
}


      </style> 
 </head> 
 <body> 
  <div class="thebox"> 
   <div class="theline"> 
   </div> 
   <h1>this is a test this is a test this is a test this is a test this is a test 
   this is a test this is a test this is a test this is a test 
   this is a test </h1> 
  </div>  
 </body>
</html>

Related Tutorials