CSS-HtmlNo Comments

default thumbnail

If we want to set a element in middle vertically then use the below css code. It’s very easy to use. Here is css.

HTML

<div class="box">
     <span>Hello</span>
</div>

CSS

.box{ width:200px; height:200px; border:1px #ddd solid; display:table;}
.box span{ display:table-cell; vertical-align:middle; text-align:center; width:100%;}

Be the first to post a comment.

Add a comment