Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > HTML > vertical-align and div

Reply
Thread Tools

vertical-align and div

 
 
Jochen Fuhrmann
Guest
Posts: n/a
 
      10-06-2003
hi, why doesn't the vertical-align work here:

div.test {top:10px;
left:10px;
width:230px;
height:90px;
text-align:center;
vertical-align:middle;}

i want to put the text in the center of the block

jochen
 
Reply With Quote
 
 
 
 
Steve Pugh
Guest
Posts: n/a
 
      10-06-2003
"Jochen Fuhrmann" <(E-Mail Removed)> wrote:

>hi, why doesn't the vertical-align work here:
>
>div.test {top:10px;
> left:10px;


Are you specifying position somewhere else? top and left only apply
when an element has a position value other than static (the default).

> width:230px;
> height:90px;
> text-align:center;
> vertical-align:middle;}


Because vertical-align only applies in two cases -
1. inline elements where it aligns the element relative to the
surrounding line of text
2. table cell elements where it aligns the content relative to the
cell

It does not apply to block level elements.

http://www.w3.org/TR/CSS2/visudet.ht...vertical-align

You can convert a block element like <div> into a teble cell element
by using display: table-cell; but IE doesn't support that.

>i want to put the text in the center of the block


http://www.aspekt1.net/ms/dev/vertical-align.html

Steve

--
"My theories appal you, my heresies outrage you,
I never answer letters and you don't like my tie." - The Doctor

Steve Pugh <(E-Mail Removed)> <http://steve.pugh.net/>
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
<div ... /> and <div ...></div> K Viltersten ASP .Net 4 03-31-2009 07:33 PM
NS/FF don't change div offsetWidth when div innerHTML is added toand div becomes wider mscir Javascript 3 06-26-2005 04:04 PM
Q: Div A inside Div B is larger than Div B Dwayne Madsen Javascript 1 06-01-2005 03:02 PM
<H1> causing a gap between head div and left column / content div Kate HTML 4 02-19-2005 10:22 PM
Re: <H1> causing a gap between head div and left column / content div Kate HTML 1 02-19-2005 06:20 PM



Advertisments