473,651 Members | 2,775 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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 7955
André Hänsel <an***@webkr.de scripsit:
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.infosystem s.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:3 px;border:dotte d black 1px;>
<input id="v_yes" type="radio" name="v" value="yes" />
Ja</label>
<br><br>
<label for="v_no"
style=padding:3 px;border:dotte d 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
2841
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 Tkinter import * class GetVariant: def __init__(self): self.root = Tk()
3
36175
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 rewrite it so that it's W3C compliant. Reading through earlier messages I concluded I should go with getElementById but this doesn't work. What am I doing wrong? Your help is much appreciated.
3
15012
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 clicked/unclicked without taking a trip back to the webserver? Is there some easy way to do this? (I'm gussing it will require JavaScript)
3
3806
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" onclick="__doPostBack('SitesRadioButtonList_3','')" language="javascript" />
6
9287
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 posted via DotNetMonster.com http://www.dotnetmonster.com/Uwe/Forums.aspx/dotnet-csharp/200605/1
1
2339
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"> <asp:ListItem Value="yes">Yes</asp:ListItem> <asp:ListItem Value="no">No</asp:ListItem> </asp:RadioButtonList> </form>
4
1602
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 Integer For n = 0 To 2 rb(n) = New RadioButton rb(n).Text = "Text: " + CStr(n)
4
12463
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 parent backcolor and add my own label to the left side? Thanks, Rich
8
44027
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 checked. In VB.Net if I enclose a group of radiobuttons in a groupbox control - I get the single checked radiobutton behavior, but the groupbox does not seem to return the index of the checked radiobutton. Is there a way to get the groupbox...
0
8357
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8277
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
8803
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
8700
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
8465
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,...
1
6158
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
4144
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
1
1910
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
2
1588
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.