css - Centering to the screen -


i want put sign in button center both horizontal , vertical of page in here. have tried put anchor tag div hasn't worked. how can that?

centering things hardest problem in computer sciences.

well depends whether want vertical or horizontal centering. horizontal centering can achieved either setting text-align: center on parent, or giving element explicit width, , margin: auto;

vertical centering more difficult. can set margin-top: or absolutely position top: of element push down, have position @ (50% of container height) - (element height / 2), css can't automatically. if element or it's container change heights you'll need adjust manually or javascript.

it's still relatively new technique flexible box-model great @ doing this. it's little more complicated, , there lot of vendor prefixes , browser inconsisencies work around, can google it.

everybody's gonna hate me saying this, in day we'd have used table , gone on our lives. see table cells allow use vertical-align: middle; you'd expect do.

#abusedtable{     width: 100%; } #abusedtable td{     height: 500px;     text-align: center;     vertical-align: middle;     border: 1px solid red; } 

http://jsfiddle.net/arkanciscan/5wymx/


Comments

Popular posts from this blog

c# - How Configure Devart dotConnect for SQLite Code First? -

java - Copying object fields -

c++ - Clear the memory after returning a vector in a function -