HighDots Forums  

Vertical align question

Cascading Style Sheets Layout/presentation on the WWW (comp.infosystems.www.authoring.stylesheets)


Discuss Vertical align question in the Cascading Style Sheets forum.



Reply
 
Thread Tools Display Modes
  #1  
Old   
Mark Smith
 
Posts: n/a

Default Vertical align question - 02-05-2009 , 11:42 AM






Hi,

I'm trying to align a checkbox vertically in a div, but I can't get it
to work:

<div style="border: 1px solid black; height:100px;vertical-
align:middle;">
<input type="checkbox" style="vertical-align:middle;"/>
</div>

Is this not correct?

Thanks

Reply With Quote
  #2  
Old   
Ben C
 
Posts: n/a

Default Re: Vertical align question - 02-05-2009 , 04:18 PM






On 2009-02-05, Mark Smith <marksmith5555 (AT) jungle-monkey (DOT) com> wrote:
Quote:
Hi,

I'm trying to align a checkbox vertically in a div, but I can't get it
to work:

div style="border: 1px solid black; height:100px;vertical-
align:middle;"
<input type="checkbox" style="vertical-align:middle;"/
/div

Is this not correct?
You need to add line-height: 100px to the DIV and line-height: normal to
the INPUT.

In fact, just adding line-height: 100px to the DIV and leaving the
checkbox as vertical-align: baseline (the default) will give a very
similar result. This is because the difference between line height and
font size is always distributed evenly above and below the line.

At the moment the checkbox is vertically aligned in the line box that
it's on, but its line box isn't 100px high, but some smaller amount
based on its font (in fact an amount usually not much higher than the
input element).


Reply With Quote
Reply




Thread Tools
Display Modes

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

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.4
Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.