Vertically align a text in a responsive div - HTML CSS CSS Layout

HTML CSS examples for CSS Layout:Responsive Layout

Description

Vertically align a text in a responsive 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">
.container, .text-container {<!--from www .j  a  va 2s .c o  m-->
   position:absolute;
   left:51%;
   top:51%;
   transform:translate(-51%, -51%);
}

.container {
   width:61%;
   height:61%;
   padding:21px;
   box-shadow:0 0 31px Chartreuse;
   border-radius:26px;
}

.text-container {
   text-align:center;
}
</style> 
 </head> 
 <body> 
  <div class="container"> 
   <div class="text-container">
     Lorem ipsum d 
    <p></p>Lorem ipsum dolor sit ame 
    <p></p>Lorem ipsum dolor sit ame 
    <p></p>Lorem ipsum d 
   </div> 
  </div>  
 </body>
</html>

Related Tutorials