Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

radio button and label aligning

Status
Not open for further replies.

Graeme06

Technical User
Jun 6, 2006
60
Hi, I've got a bunch of radio buttons with labels. The thing is that the radio button seems a little high compared to the label (they are not vertically alligned perfectly). I've tried CSS but gotten no where, although I'm probably doing something wrong. Any ideas?

Thanks,
Graeme
 
thanks, but that does the same thing. Is there any CSS I need to add on top of that?
 
I'm not sure exactly how you want it to look, but try using vertical-align on the input tag. It'll change how it's aligned. Perhaps text-top will be to your liking.
 
Not true. My code:
Code:
<!DOCTYPE XHTML PUBLIC "-//W3C//DTD HTML 1.0 Transitional//EN" "[URL unfurl="true"]http://www.w3.org/TR/xhtml1/xhtml1-loose.dtd">[/URL]
<html>
<head><title></title>
</head>
<body>
<label for="rb1">Yes
  <input type="radio" name="rb1" value="y" style="vertical-align:bottom;" />
</label>
</body>
</html>

W3C:

'vertical-align'
Applies to: inline-level and 'table-cell' elements
 
show me the difference in these two:

Code:
<!DOCTYPE HTML PUBLIC  "-//W3C//DTD HTML 4.01 Transitional//EN" 
    "[URL unfurl="true"]http://www.w3.org/TR/html4/loose.dtd">[/URL]

<html>
<head>
<title>Untitled</title>
</head>

<body>

<label for="rb1">Yes
  <input type="radio" name="rb1" id="rb1" value="y" style="vertical-align:bottom;" />
</label>

<label for="rb2">Yes
  <input type="radio" name="rb2" id="rb2" value="y" />
</label>

</body>
</html>



*cLFlaVA
----------------------------
[tt]mr. pibb + red vines = crazy delicious![/tt]

[URL unfurl="true"]http://www.coryarthus.com/[/url]
 
or this:

Code:
<!DOCTYPE HTML PUBLIC  "-//W3C//DTD HTML 4.01 Transitional//EN" 
    "[URL unfurl="true"]http://www.w3.org/TR/html4/loose.dtd">[/URL]

<html>
<head>
<title>Untitled</title>
</head>

<body>

<div style="height: 300px; border: 1px solid black;">
<label for="rb1">Yes
  <input type="radio" name="rb1" id="rb1" value="y" style="vertical-align:bottom;" />
</label>

<label for="rb2">Yes
  <input type="radio" name="rb2" id="rb2" value="y" />
</label>

<img src="[URL unfurl="true"]http://www.tek-tips.com/images/partnerbtn120x60.gif"[/URL] style="vertical-align: bottom;" />
<img src="[URL unfurl="true"]http://www.tek-tips.com/images/partnerbtn120x60.gif"[/URL] />

</div>

</body>
</html>

radio buttons are looking the same...



*cLFlaVA
----------------------------
[tt]mr. pibb + red vines = crazy delicious![/tt]

[URL unfurl="true"]http://www.coryarthus.com/[/url]
 
Screenshot.png


Maybe it doesn't work in IE. I'm on my Linux box and can't test it. I'm not intending to start a flame war, but as you can see, it's working for me.
 
well that looks somewhat better, thanks. I still don't get why I can't just add some padding though.
 
oh and by the way, it does chang ethe allignemtn of the radio buttons. Whether it is valid or not, I haven't checked yet.
 
lol, I just realized why it was working for me. I was using Firefox 2.0 beta 1, and it would seem that it interprets that property a little better.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top