how to center text in css ?

J

Jonathan N. Little

richard said:
Actually, I need to know how to put the text in the middle of the division.
As I did with tables.
Vertical-align doesn't seem to be recognized.

www.1-small-world.com/index2.html

Look it up for yourself and see why...

http://www.w3.org/TR/CSS21/propidx.html

property: 'vertical-align'
applies to: inline-level and 'table-cell' elements

DIV is neither. You can set DIV to "display: table-cell;" ...but guess
what? You guessed it, it will not work in IE. Other options are padding
and line-height all a bit messy.
 
R

richard

R

richard

Jonathan N. Little said:
As I said a bit messy as opposed to:

DIV.deadcenter {
display: table-cell; text-align: center; vertical-align: middle;
}

I have tried it and it does not appear to work.
Eventually I may find something that will.
 
J

Jonathan N. Little

richard said:
I have tried it and it does not appear to work.
Eventually I may find something that will.

It will *not* work in IE but *does* in "modern" browsers, that was my
point. Therefore if you wish to accommodate Ol'IE you have to resort to
a kludge of nested elements and playing with margins, padding and stuff....
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,580
Members
45,054
Latest member
TrimKetoBoost

Latest Threads

Top