Go Back   CodingForums.com > :: Client side development > HTML & CSS

Before you post, read our: Rules & Posting Guidelines

Reply
 
Thread Tools Rate Thread
Enjoy an ad free experience by logging in. Not a member yet? Register.
Old 12-19-2009, 03:14 AM   PM User | #1
bazz
Master Coder

 
Join Date: Apr 2003
Location: in my house
Posts: 5,211
Thanks: 39
Thanked 201 Times in 197 Posts
bazz will become famous soon enoughbazz will become famous soon enough
radio buttons display practices tips plz.

Hi,

I have a set 6 sets of 5 radio buttons. I would prefer to have each set in a row of 5 buttons but, can you tell me what best practice would be for spreading them out?

I don't want confusion to creep in where a button is equidistant between 1 and 2 for example. I have used   to make it layout more clearly but I am not sure that is the correct/best way.

Should I, instead, be adding padding to the right of the radio buttons?

Code:
          <fieldset>
            <legend>Welcome</legend>
            1 <input type='radio' name="Welcome" /> &nbsp;&nbsp;&nbsp;&nbsp;
            2 <input type='radio' name="Welcome" /> &nbsp;&nbsp;&nbsp;&nbsp;
            3 <input type='radio' name="Welcome" /> &nbsp;&nbsp;&nbsp;&nbsp;

            4 <input type='radio' name="Welcome" /> &nbsp;&nbsp;&nbsp;&nbsp;
            5 <input type='radio' name="Welcome" /> &nbsp;&nbsp;&nbsp;&nbsp;
          </fieldset>
bazz
__________________
"The day you stop learning is the day you become obsolete"! - my late Dad.

Why do some people say "I don't know for sure"? If they don't know for sure then, they don't know!
Useful MySQL resource
Useful MySQL link
bazz is offline   Reply With Quote
Old 12-19-2009, 03:46 AM   PM User | #2
vineet
Regular Coder

 
Join Date: Jun 2008
Posts: 173
Thanks: 2
Thanked 9 Times in 9 Posts
vineet is an unknown quantity at this point
padding may not work. but you can use right margin

Code:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>Untitled Document</title>
<style type="text/css">
.radio{
margin-right:35px;
}
</style>
</head>
<body>
   <fieldset>
            <legend>Welcome</legend>
            1 <input type='radio' name="Welcome" class="radio" />
            2 <input type='radio' name="Welcome" class="radio"  /> 
            3 <input type='radio' name="Welcome" class="radio"  />
            4 <input type='radio' name="Welcome" class="radio"  />
            5 <input type='radio' name="Welcome" class="radio"  />
          </fieldset>
</body>
</html>
vineet

Last edited by vineet; 12-19-2009 at 05:51 AM..
vineet is offline   Reply With Quote
Old 12-19-2009, 06:44 AM   PM User | #3
bazz
Master Coder

 
Join Date: Apr 2003
Location: in my house
Posts: 5,211
Thanks: 39
Thanked 201 Times in 197 Posts
bazz will become famous soon enoughbazz will become famous soon enough
Thanks, I'll try that.

bazz
__________________
"The day you stop learning is the day you become obsolete"! - my late Dad.

Why do some people say "I don't know for sure"? If they don't know for sure then, they don't know!
Useful MySQL resource
Useful MySQL link
bazz is offline   Reply With Quote
Old 12-19-2009, 09:26 AM   PM User | #4
abduraooft
Supreme Master coder!

 
abduraooft's Avatar
 
Join Date: Mar 2007
Location: N/A
Posts: 14,678
Thanks: 158
Thanked 2,182 Times in 2,169 Posts
abduraooft is just really niceabduraooft is just really niceabduraooft is just really niceabduraooft is just really niceabduraooft is just really nice
How about
Code:
fieldset label{
float:left;
width:5em;
text-align:right;
}
Code:
<fieldset>
	<legend>Set 1</legend>
	<label>1<input type='radio' name="Welcome" /></label> 
	<label>2<input type='radio' name="Welcome" /></label> 
	<label>3<input type='radio' name="Welcome" /></label> 
	<label>4<input type='radio' name="Welcome" /></label> 
	<label>5<input type='radio' name="Welcome" /></label> 
</fieldset>
?
__________________
Quote:
The Dream is not what you see in sleep; Dream is the thing which doesn't let you sleep. --(Dr. APJ. Abdul Kalam)
abduraooft is offline   Reply With Quote
Old 12-19-2009, 10:40 AM   PM User | #5
bazz
Master Coder

 
Join Date: Apr 2003
Location: in my house
Posts: 5,211
Thanks: 39
Thanked 201 Times in 197 Posts
bazz will become famous soon enoughbazz will become famous soon enough
Ah, thanks. I hadn't thought of using label for help with spacing.

bazz
__________________
"The day you stop learning is the day you become obsolete"! - my late Dad.

Why do some people say "I don't know for sure"? If they don't know for sure then, they don't know!
Useful MySQL resource
Useful MySQL link
bazz is offline   Reply With Quote
Old 12-19-2009, 10:51 AM   PM User | #6
abduraooft
Supreme Master coder!

 
abduraooft's Avatar
 
Join Date: Mar 2007
Location: N/A
Posts: 14,678
Thanks: 158
Thanked 2,182 Times in 2,169 Posts
abduraooft is just really niceabduraooft is just really niceabduraooft is just really niceabduraooft is just really niceabduraooft is just really nice
Quote:
Originally Posted by bazz View Post
Ah, thanks. I hadn't thought of using label for help with spacing.

bazz
That <label>s are not just for spacing. You could click on those labels to select the respective radio button, which enhances the usability.
__________________
Quote:
The Dream is not what you see in sleep; Dream is the thing which doesn't let you sleep. --(Dr. APJ. Abdul Kalam)

Last edited by abduraooft; 12-19-2009 at 10:55 AM..
abduraooft is offline   Reply With Quote
Old 12-19-2009, 02:30 PM   PM User | #7
bazz
Master Coder

 
Join Date: Apr 2003
Location: in my house
Posts: 5,211
Thanks: 39
Thanked 201 Times in 197 Posts
bazz will become famous soon enoughbazz will become famous soon enough
Thanks. yeh I knew about the accessibility bit but hadn't thought of using css with it for spacing

server-side has kept me away from css and I am forgetting some of it.

bazz
__________________
"The day you stop learning is the day you become obsolete"! - my late Dad.

Why do some people say "I don't know for sure"? If they don't know for sure then, they don't know!
Useful MySQL resource
Useful MySQL link
bazz is offline   Reply With Quote
Reply

Bookmarks

Jump To Top of Thread


Thread Tools
Rate This Thread
Rate This Thread:

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

Forum Jump


All times are GMT +1. The time now is 01:09 AM.


Advertisement
Log in to turn off these ads.