horizontally center align this absolutely positioned `<a>` tag inside the relatively positioned div - HTML CSS CSS Layout

HTML CSS examples for CSS Layout:Relative Position

Description

horizontally center align this absolutely positioned `<a>` tag inside the relatively positioned 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">
.wrapper {<!--from  ww  w  . ja va 2s  .com-->
   position:relative;
   width:91%;
   max-width:91%;
   margin:0px auto;
   left:0px;
   right:0px;
   text-align:center;
}

.anchor {
   display:inline-block;
   width:25%;
   height:301px;
   max-height:401px;
   min-height:191px;
   top:0px;
   background-size:cover;
   background-position:center center;
   text-decoration:none;
   margin:11px 0;
}

.span-container {
   left:11%;
   bottom:11%;
   width:81%;
}

.span-one {
   font-size:272.580%;
   color:Chartreuse;
}

.span-two {
   font-size:215.738%;
   color:yellow;
   font-weight:100;
   line-height:0.10;
}
</style> 
 </head> 
 <body> 
  <div class="wrapper"> 
   <a class="anchor anchorx" href="#" style="background-image: url(http://static.hdw.eweb4.com/media/wallpapers_dl/1/106/1058184-beautiful-landscapes.jpg);"> <span class="span-container"> <span class="span-one">Lorem ip</span> <span class="span-two">Lorem ip</span> </span> </a> 
   <a class="anchor anchorx" href="#" style="background-image: url(http://static.hdw.eweb4.com/media/wallpapers_dl/1/106/1058184-beautiful-landscapes.jpg);"> <span class="span-container"> <span class="span-one">Lorem ip</span> <span class="span-two">Lorem ip</span> </span> </a> 
   <a class="anchor anchorx" href="#" style="background-image: url(http://static.hdw.eweb4.com/media/wallpapers_dl/1/106/1058184-beautiful-landscapes.jpg);"> <span class="span-container"> <span class="span-one">Lorem ip</span> <span class="span-two">Lorem ip</span> </span> </a> 
   <a class="anchor anchorx" href="#" style="background-image: url(http://static.hdw.eweb4.com/media/wallpapers_dl/1/106/1058184-beautiful-landscapes.jpg);"> <span class="span-container"> <span class="span-one">Lorem ip</span> <span class="span-two">Lorem ip</span> </span> </a> 
   <a class="anchor anchorx" href="#" style="background-image: url(http://static.hdw.eweb4.com/media/wallpapers_dl/1/106/1058184-beautiful-landscapes.jpg);"> <span class="span-container"> <span class="span-one">Lorem ip</span> <span class="span-two">Lorem ip</span> </span> </a> 
  </div>  
 </body>
</html>

Related Tutorials