html - Verticle text align for multiple lines -


1) wondering how can have text in 1 block aligned centerally in page (both vertically , horizontally). 2) want each line of text flush other lines of text. ideas?

demo

html

<div class="row">     <div class="panel">         <div class="large-12 columns" id="date"><span>5th may 2014</span>         </div>         <div class="row">             <div class="large-12 columns" id="title"><span>highgate market & fair</span>             </div>             <div class="row">                 <div class="large-12 columns" id="desc"><span>arts, crafts, collectables , fine foods</span>                  </div>                 <div class="row">                     <div class="large-12 columns" id="address"><span>lauderdale house waterlow park highgate hill highgate n6 5hg</span>                     </div>                 </div>             </div> 

css

 #date {         font-size: 114.42px;     }     #title {         font-size: 61.88px;     }     #desc {         font-size: 33.27px;     }     #address {         font-size: 21.68px;     }     .panel {         background-color: #202020;         border-style: none;     }     @font-face {         font-family:'adamregular';         src: url('adam-webfont.eot');         src: url('adam-webfont.eot?#iefix') format('embedded-opentype'), url('adam-webfont.woff') format('woff'), url('adam-webfont.ttf') format('truetype'), url('adam-webfont.svg#adamregular') format('svg');         font-weight: normal;         font-style: normal;     }     body {         font-family:'adam';         color: #b9b8b9;         background-color: #202020;         text-align: center;         position: absolute;         top: 0 bottom: 0;         left: 0;         right: 0;     } 

thanks

example fiddle: http://jsfiddle.net/t2t69/1/


with markup provided can remove absolute position body , add style

html, body {     height: 100%;      margin: 0;     padding: 0;  }  body {     display: table;     width: 100%;  }   body > .row {     display: table-cell;     vertical-align: middle;    text-align: center;  } 

example screenshot (on firefox 27)

enter image description here


as side note, suggest use cleaner markup instead of nested div, like

<section>    <time datetime="2014-05-05">5th may 2014</time>    <h1>highgate market & fair <span>arts, crafts, ..., foods</span></h1>     <p>lauderdale house waterlow park highgate hill highgate n6 5hg</p> </section> 

Comments

Popular posts from this blog

android - Get AccessToken using signpost OAuth without opening a browser (Two legged Oauth) -

org.mockito.exceptions.misusing.InvalidUseOfMatchersException: mockito -

google shop client API returns 400 bad request error while adding an item -