Let's talk Contact us. No cost. No obligation.

Fill out this form and we will contact you with in 24 hrs.

    captcha

     

    Knowledge Base

    How to align the div section or text vertically with CSS

    June 22, 2017

    How to do Vertical Center?
    For a variable amount of text that you want to centre vertically
    and horizontally, you can use display: table-cell and
    vertical-align: middle.

    Example:-
    HTML:-

    Some text

    Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry’s standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book. It has survived not only five centuries, but also the leap into electronic typesetting, remaining essentially unchanged. It was popularised in the 1960s with the release of Letraset sheets containing Lorem Ipsum passages, and more recently with desktop publishing software like Aldus PageMaker including versions of Lorem Ipsum.

    CSS:-
    .vertical-wrapper{margin:0px; padding:0px; position:absolute; left:0px; top:0px; display:table; height:100%; width:100%;}
    .vertical-content-area{margin:0px; padding:0px; display:table-cell; vertical-align:middle;}
    .center-row{margin:0px auto; width:500px; padding:20px; background:#000; color:#fff; }