473,594 Members | 2,713 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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">Test 1:</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">Test 2:</label>
<div id="rank-input">Worse&nb sp;
<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">Test 3:</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>

Feb 17 '07 #1
4 15899
Greg Scharlemann wrote:
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
Feb 18 '07 #2
>
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...

Feb 18 '07 #3
Scripsit Greg Scharlemann:
>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/

Feb 18 '07 #4
Greg Scharlemann wrote:
>>
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
Feb 18 '07 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

6
5184
by: amith | last post by:
hi, i have some 10 radio buttons meant to take the rating from the user. ex: 1 2 3 4 5 6 7 8 9 10 looks O O O O O O O O O O 1 2 3 4 5 6 7 8 9 10 features O O O O O O O O O O
2
3135
by: Jeff | last post by:
I'm trying to create a dynamic form that can have multiple groups of radio buttons (each group has two buttons) with the same name. Essentially, the form allows a user to enter as many names as they want. If they need to add more, they click an "add name" button and the javascript inserts another row of input boxes. Each row should have two radio buttons to indicate sex (M F). When you have multiple text input boxes with the same...
4
3266
by: Oscar Monteiro | last post by:
I Have to sets of Radio buttons like so: <input type="radio" name=p1 value=1> <input type="radio" name=p1 value=2> <input type="radio" name=p1 value=3> <br> <input type="radio" name=p2 value=1> <input type="radio" name=p2 value=2> <input type="radio" name=p2 value=3> then a text area and a button:
6
3273
by: Craig Keightley | last post by:
I have a page that has n number of radio groups (yes/No) how can i prevent the form being submitted if more than one radio group is not selected? By default all radio groups are unchecked The problem i am facing is that i do not know how many yes/no radio groups will be generated
7
1652
by: Scott Teglasi | last post by:
Hi all, I was curious as to how others whom have dealt with this problem have handled it. The problem is that I have a site design of a fixed width and height and want to center that content in the middle of the browser's viewport, both horizontally AND vertically. The site I'm building requires that I adhere to the HTML 4.01
1
3216
by: IchBin | last post by:
I am trying to set the state of a radio button. I do not see what I am doing wrong. Sorry, I am new at this.. I need another set of eyes to look at this snip of code. I am trying to set the radio button with this link of code: echo 'SCRIPT language=JavaScript setCheckedValue("'.$_SESSION.'");</SCRIPT>'; //? <snip of code>
10
6065
by: IchBin | last post by:
I am trying to set the state of a radio button. I do not see what I am doing wrong. Sorry, I am new at this.. I need another set of eyes to look at this snip of code. I am trying to set the radio button with this link of code: echo 'SCRIPT language=JavaScript setCheckedValue("'.$_SESSION.'");</SCRIPT>'; //? <snip of code>
2
5883
by: dpazza | last post by:
Hi, I'm creating a quiz on using a form in VB 2005 express. I have four sets of questions and answers (labels and radio buttons) and I change between which set of questions is currently shown on the form by changing the visible state of the radio buttons and labels utilising back and next buttons. E.g. Next button makes current radio buttons and labels invisible and
1
3109
by: lolodede | last post by:
i have php page with 4 radio buttons and text box if user chose first two radio buttons then the next page need to display the results depending which radio buttons select but other two depend on value on textbox entered then spefic fields should be shows but i have no idea how to do that how can i get radio buttons <?php require_once("nocache.php"); session_start(); if (!$_SESSION){ header ("location:logoff.php");} ?> <?xml...
0
7876
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
8251
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
8372
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
8003
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
6654
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
5739
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
3897
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2385
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
0
1210
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.