473,405 Members | 2,421 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,405 software developers and data experts.

Label of radiobutton

Hi again,

I have a radio button:
<p>
<input id="v_yes" type="radio" name="v" value="yes" />
<label for="v_yes">Ja</label>
<input id="v_no" type="radio" name="v" value="no" />
<label for="v_no">Nein</label>
</p>

This looks like this:
http://kundenweb.creations.de/usenet/radiobuttons.gif

How can I position the labels beside the radio buttons?

Regards,
André

Jul 4 '06 #1
2 7944
André Hänsel <an***@webkr.descripsit:
I have a radio button:
<p>
<input id="v_yes" type="radio" name="v" value="yes" />
<label for="v_yes">Ja</label>
<input id="v_no" type="radio" name="v" value="no" />
<label for="v_no">Nein</label>
</p>
For a simple yes/no question, a checkbox is better (more natural, more
useable) than a pair of radio buttons. But perhaps the example is just a
dummy one. If you really wanted to use such a pair, better markup would be

<fieldset>
<legend>(put here the question to be answered,
or a caption for it)</legend>
<div><input id="v_yes" type="radio" name="v" value="yes" />
<label for="v_yes">Ja</label></div>
<div><input id="v_no" type="radio" name="v" value="no" />
<label for="v_no">Nein</label></div>
</fieldset>

This naturally raises some styling issues different from those of your
markup that illogically marks the pair as a paragraph of text and causes
some default top and bottom margins on most browsers.
This looks like this:
http://kundenweb.creations.de/usenet/radiobuttons.gif

How can I position the labels beside the radio buttons?
The essential thing (for usability) is to make each label/field pair appear
on one line. This should be handled in HTML, not CSS. Using <divis my
favorite, and <br(or <br /if you wish to use XHTML on the www for some
odd reason) is another way. Using <divlets you style the label/field pair
as an element.

Other essential things are the use of a sufficient font size, preferably
letting the user decide (i.e., not setting font size at all) and sufficient
contrast between background and text color. The image illustrates how you
have made things much worse than browser defaults in this respect, so I
think _this_ is the primary problem that you should solve.

I guess that the problem you _thought_ as important now is the vertical
alignment. It is apparently causes by something in your style sheet. Since I
cannot see how you created the problem, I won't discuss the ways to solve it
except by saying that you should probably start by removing _all_ CSS rules
related to the rendering of the form. There might still be some rules in
your style sheet that mess up the rendering.

It is generally advisable to post the URL of the problem page (not just code
snippet or screen capture) before being asked to.

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

Jul 5 '06 #2
André Hänsel wrote on 05 jul 2006 in
comp.infosystems.www.authoring.stylesheets:
I have a radio button:
<p>
<input id="v_yes" type="radio" name="v" value="yes" />
<label for="v_yes">Ja</label>
<input id="v_no" type="radio" name="v" value="no" />
<label for="v_no">Nein</label>
</p>

This looks like this:
http://kundenweb.creations.de/usenet/radiobuttons.gif

How can I position the labels beside the radio buttons?
Beside?

You mean inside or next to?

Or this?

<p>
<label for="v_yes"
style=padding:3px;border:dotted black 1px;>
<input id="v_yes" type="radio" name="v" value="yes" />
Ja</label>
<br><br>
<label for="v_no"
style=padding:3px;border:dotted black 1px;>
<input id="v_no" type="radio" name="v" value="no" />
Nein</label>
</p>
--
Evertjan.
The Netherlands.
(Please change the x'es to dots in my emailaddress)
Jul 5 '06 #3

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

Similar topics

8
by: VK | last post by:
Hi! What I'm missing in following code? Cannot get the values of radiobuttons. Starting only one class (GetVariant), it works. When I put two classes together, it doesn't. Regards, VK from...
3
by: sofie | last post by:
Hello all, I use the following javascript function in a html document to set the level of one of eight available radiobuttons. The line that's commented out works fine under IE, but I need to...
3
by: Jason | last post by:
I am new to WebForms and am far more comfortable with WinForms. I am wondering how simple things such as showing/hiding a label and textbox can be accomplished if a certain Radiobutton option is...
3
by: Josef K. | last post by:
Asp.net generates the following html when producing RadioButton lists: <td><input id="RadioButtonList_3" type="radio" name="MyRadioButtonList" value="644"...
6
by: Radiobutton via DotNetMonster.com | last post by:
i need help with radiobuttons. i am useing 1button and 2 radiobuttons i am trying to make it so when u select a radiobutton and hit button1 it will clear radiobuttons 1 and 2. -- Message...
1
by: rn5a | last post by:
A ASPX page has a RadioButtonList with 2 ListItems - 'Yes' & 'No' <form runat="server"> <asp:RadioButtonList ID="rdlAdd" OnSelectedIndexChanged="ShowHide" AutoPostBack="true" runat="server">...
4
by: Igor | last post by:
RadioButton have property Checked (true or false). If I make RadioButtons with code, without drawing by mouse than I have problems. I write like this: Dim rb(0 To 2) As RadioButton Dim n As...
4
by: =?Utf-8?B?UmljaA==?= | last post by:
Hello, Is there a setting/property for displaying a checkbox label (or radiobutton label) on the left hand side instead of the right hand side? Or am I limited to no text in the label - take on...
8
by: =?Utf-8?B?UmljaA==?= | last post by:
If you enclose a group of radiobuttons (option buttons in MS Access) in an option group control (a frame control) in Access -- the frame control will return the index of the option button that is...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
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,...
0
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...
0
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...
0
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,...
0
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...

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.