Help | Site Map
Connecting Tech Pros Worldwide
 
 
LinkBack Thread Tools
  #1  
Old February 17th, 2007, 05:45 PM
Greg Scharlemann
Guest
 
Posts: n/a
Default vertically aligning radio buttons with a header

I'm having difficulty getting the radio buttons to align vertically
with one another and the header (1 2 3 4 5) at the top. Ideally each
radio button will be directly below the one above it and the number 1
will be atop the first radio button starting at the left. Any
thoughts on how to achieve this?

<html>
<head>
<title></title>
<style type="text/css">
label {display:block; float:left; width: 130px; padding: 0;
margin: 5px 0 0; text-align: right;}
#categories {border:1px solid #000; text-align:center; font-
weight:bold;
letter-spacing:0.55em; }
#rank-input {text-align:center; border:1px solid #000; padding-left:
1em;
width:100%; height:3.0em; vertical-align:middle;}
</style>
</head>
<body>
<div id="categories">1 2 3 4 5</div>
<label for="test">Test1:</label>
<div id="rank-input">Bad&nbsp;
<img src="images/frown.gif" title="bad" />
<input type="radio" value="1" name="1" />
<input type="radio" value="2" name="1" />
<input type="radio" value="3" name="1" />
<input type="radio" value="4" name="1" />
<input type="radio" value="5" name="1" />
<img src="images/smile.gif" title="good" />&nbsp;Good
</div>
<label for="test">Test2:</label>
<div id="rank-input">Worse&nbsp;
<img src="images/frown.gif" title="bad" />
<input type="radio" value="1" name="2" />
<input type="radio" value="2" name="2" />
<input type="radio" value="3" name="2" />
<input type="radio" value="4" name="2" />
<input type="radio" value="5" name="2" />
<img src="images/smile.gif" title="good" />&nbsp;Better
</div>
<label for="test">Test3:</label>
<div id="rank-input">Terrible&nbsp;
<img src="images/frown.gif" title="bad" />
<input type="radio" value="1" name="3" />
<input type="radio" value="2" name="3" />
<input type="radio" value="3" name="3" />
<input type="radio" value="4" name="3" />
<input type="radio" value="5" name="3" />
<img src="images/smile.gif" title="good" />&nbsp;Great
</div>
</body>
</html>

  #2  
Old February 18th, 2007, 03:35 AM
Bergamot
Guest
 
Posts: n/a
Default Re: vertically aligning radio buttons with a header

Greg Scharlemann wrote:
Quote:
I'm having difficulty getting the radio buttons to align vertically
with one another and the header (1 2 3 4 5) at the top.
Use a table

--
Berg
  #3  
Old February 18th, 2007, 03:45 AM
Greg Scharlemann
Guest
 
Posts: n/a
Default Re: vertically aligning radio buttons with a header

>
Quote:
Use a table
>
I am trying to do it using CSS and without having to individually pad
each row on the left side to get the columns to line up. There has
got to be a way...

  #4  
Old February 18th, 2007, 11:05 AM
Jukka K. Korpela
Guest
 
Posts: n/a
Default Re: vertically aligning radio buttons with a header

Scripsit Greg Scharlemann:
Quote:
Quote:
>Use a table
>>
I am trying to do it using CSS and without having to individually pad
each row on the left side to get the columns to line up. There has
got to be a way...
What makes you think there has got to be a way? There are myriads of things
that just cannot be done in CSS.

Radio buttons have idiosyncratic renderings. You can apply vertical-align to
them, but you cannot expect consistent results, since you cannot know what
is the widget that you are centering - is it the circle, or a hypothetical
box containing the circle, or something quite different. (There is no
specification of what a radio button _should_ or _shall_ look like.)

--
Jukka K. Korpela ("Yucca")
http://www.cs.tut.fi/~jkorpela/

  #5  
Old February 18th, 2007, 02:35 PM
Bergamot
Guest
 
Posts: n/a
Default Re: vertically aligning radio buttons with a header

Greg Scharlemann wrote:
Quote:
Quote:
>>
>Use a table
>>
I am trying to do it using CSS and without having to individually pad
each row on the left side to get the columns to line up.
Rows and columns... sounds like tabular data to me. Use a table.

If you insist on using CSS, then consider what the content will look
like when stylesheets aren't applied. Will it still make sense?

--
Berg
 

Bookmarks

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 Off
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

What is Bytes?

We are a network of experts and professionals in IT and software development that help one another with answers to tough questions and share insights. Get the best answers to your questions from over network members.
Post your question now . . .
It's fast and it's free

Popular Articles