General Question

bluemukaki's avatar

Does the tag 'vertical-align' actually work in CSS?

Asked by bluemukaki (4332points) March 18th, 2008

I’m trying to get some text to align to the middle of a 30px high div on my site, and I got the tag vertical-align: middle; from the W3Schools site, but it doesn’t seem to work… the rest of the CSS style is:

.tabl {
background-image: url(‘images/tab_l.png’);
background-repeat: no-repeat;
float: left;
color: #FFFFFF;
text-align: center;
min-width: 9px;
min-height: 30px;
max-width: 9px;
max-height: 30px;
}

Observing members: 0 Composing members: 0

6 Answers

jrpowell's avatar

This might help. Sorry, it isn’t in English but it shouldn’t be hard to understand.

http://css-happylife.com/template/centering/

jrpowell's avatar

And I should add that it isn’t you. It is broken. Works great in tables. This is where I should bitch about Microsoft.

Perchik's avatar

Why use min-width stuff? Can’t you just set the width?

stephen's avatar

normal problem, if the text is in one row. then set the line-height with the same value of height of the div, it will work well. and if texts are in more than one rows then you need javascript to control them! its also easy

Perchik's avatar

It’d be bulky, but you could put a second div or a span inside of the div, then center that inside of the big one.

bluemukaki's avatar

@Perchick, the minimum width stuff was from another part that needs a flexible width (text goes inside it) and I just copied it across, I normally go through and remove this kind of stuff when it actually works.

Thanks Guys!

Answer this question

Login

or

Join

to answer.

This question is in the General Section. Responses must be helpful and on-topic.

Your answer will be saved while you login or join.

Have a question? Ask Fluther!

What do you know more about?
or
Knowledge Networking @ Fluther