CSS :before with content with paddings - HTML CSS CSS Property

HTML CSS examples for CSS Property:padding

Description

CSS :before with content with paddings

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">
div.wrapper {<!--from   w  w w .  j  av a2s  . c o  m-->
   border:2px solid Chartreuse;
   padding:11px 11px 6px 11px;
   border-style:dashed;
}

div.wrapper:before {
   content:'FAQ wrapper';
   font-size:11px;
   position:relative;
   top:-21px;
   color:yellow;
   background:white;
   padding-left:6px;
   padding-right:6px;
}

div.wrapper div.item {
   border:2px solid blue;
   padding:11px;
   margin-bottom:11px;
   border-style:dashed;
}

div.wrapper div.item:before {
   content:'FAQ item';
   font-size:11px;
   position:relative;
   top:-21px;
   color:pink;
   background:white;
   padding-left:6px;
   padding-right:6px;
}

div.wrapper div.item div.question {
   border:2px solid OrangeRed;
   padding:16px;
   margin-bottom:11px;
   position:relative;
}

div.wrapper div.item div.question:before {
   content:'Question';
   font-size:11px;
   position:absolute;
   top:-7px;
   color:grey;
   background:white;
   padding-left:6px;
   padding-right:6px;
}

div.wrapper div.item div.answer {
   border:2px solid BlueViolet;
   padding:16px;
}

div.eni-faq-wrapper div.eni-faq-item div.eni-faq-answer:before {
   content:'Answer';
   font-size:11px;
   position:relative;
   top:-26px;
   color:Chartreuse;
   background:white;
   padding-left:6px;
   padding-right:6px;
}
</style> 
 </head> 
 <body> 
  <div class="wrapper"> 
   <div class="item"> 
    <div class="question"> 
     <a>Lorem ipsum dolo</a> 
    </div> 
    <div class="answer"> 
     <p>Lorem ipsum dol</p> 
    </div> 
   </div> 
   <div class="item"> 
    <div class="question"> 
     <a>Lorem ipsum dolo</a> 
    </div> 
    <div class="answer"> 
     <p>Lorem ipsum dol</p> 
    </div> 
   </div> 
   <div class="item"> 
    <div class="question"> 
     <a>Lorem ipsum dolo</a> 
    </div> 
    <div class="answer"> 
     <p>Lorem ipsum dol</p> 
    </div> 
   </div> 
  </div>  
 </body>
</html>

Related Tutorials