Add centered text below div - HTML CSS CSS Layout

HTML CSS examples for CSS Layout:Text

Description

Add centered text below div

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">
.box {<!--from w  w w  . jav a  2s.com-->
   display:flex;
   font-size:.876em;
}

.box>div {
   text-align:center;
   display:flex;
   flex-direction:column;
   align-items:center;
   overflow:hidden;
}

.circle {
   display:block;
   width:51px;
   height:51px;
   border-radius:51px;
   border:6px solid Chartreuse;
   position:relative;
}

.circle:after,
.circle:before {
   content:'';
   position:absolute;
   top:0;
   bottom:0;
   height:6px;
   margin:auto;
   background:yellow;
}

.circle:before {
   left:-10001%;
   width:10001%;
}

.circle:after {
   right:-10001%;
   width:10001%;
}

.circle--first:before {
   display:none;
}

.circle--last:after {
   display:none;
}
</style> 
 </head> 
 <body> 
  <div class="box"> 
   <div> 
    <span class="circle circle--first"></span> 
    <p>test</p> 
   </div> 
   <div> 
    <span class="circle"></span> 
    <p>test</p> 
   </div> 
   <div> 
    <span class="circle circle--last"></span> 
    <p>test</p> 
   </div> 
  </div>  
 </body>
</html>

Related Tutorials