div and vertical align

T

Tobias Müller

Hi,

doesn't "div" supports vertical align?

<div class="text">Hello World</div>

and

..text {
height: 100px;
vertical-align: bottom;
}

doens't work. Any hints?

Regards from Germany
Tobias
 
J

Jukka K. Korpela

Tobias Müller said:
doesn't "div" supports vertical align?

The vertical-align property (which is CSS, not HTML) applies to inline
elements and table cell elements only. By default, a div element is a block
element.
 
S

Steve Pugh

Tobias Müller said:
doesn't "div" supports vertical align?

No. Nor does any other block level element. Look it up in the CSS spec
- http://www.w3.org/TR/CSS2/visudet.html#propdef-vertical-align

"Applies to: inline-level and 'table-cell' elements"
<div class="text">Hello World</div>


.text {
height: 100px;
vertical-align: bottom;
}

doens't work. Any hints?

Use padding and/or line-height. Or if IE is not required to support
this part of the presentation use display: table-cell along with
vertical-align.

Steve
 

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

Forum statistics

Threads
473,768
Messages
2,569,574
Members
45,048
Latest member
verona

Latest Threads

Top