Link to home
Start Free TrialLog in
Avatar of Pinapple Pink
Pinapple Pink

asked on

Aligning radio-buttons labels in a table

Hello all,

Since the <center> tag is considered obsolete in HTML, I am wondering how to then align a set of radio buttons with a <table> document. I have tried using CSS here with the following:

radiobutton
{
text-align: center;

}

But instead got a result of the click-section centered themselves, but not the labels that precede the buttons. The radio-buttons themselves are associated with an id tag. Should I align them using the tag-reference instead?

What are your suggestions?
Avatar of Julian Hansen
Julian Hansen
Flag of South Africa image

Can you show us your html - a sample of a row with some radio buttons
For radio buttons and checkboxes, it's usually best for the label to be to the right and for them to be left aligned.

For more specific help, we'll need to see the page in question.
Avatar of Pinapple Pink
Pinapple Pink

ASKER

https://paste.ofcode.org/WHAPQkJx7hRVBY7HpPPhrt

The code source can be found here. The radio buttons need to be aligned on the left side of the <td> tag so that they uniformly go down vertically down the center with their toggle options.
You mean like this
<td><!--Radio Button Assigned values and Letters-->
	<div><input type="radio"name="Color" id="w" value="White">
	<label for="w">White</label></div>
	<div><input type="radio" name="Color" id="s" value="Silver">
	<label for="s">Silver</label></div>
	<div><input type="radio" name="Color" id="r" value="Red">
	<label for="r">Red</label></div>
	<div><input type="radio" name="Color" id="b" value="Blue">
	<label for="b">Blue</label></div>
</td>

Open in new window

You could also put the <input> inside the <label> and then make the lable
td label {
  display: block;
}

Open in new window

This question needs an answer!
Become an EE member today
7 DAY FREE TRIAL
Members can start a 7-Day Free trial then enjoy unlimited access to the platform.
View membership options
or
Learn why we charge membership fees
We get it - no one likes a content blocker. Take one extra minute and find out why we block content.