Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What is the best way to left align radio buttons on top of each other?

I have a bunch of radio buttons, and I have a

<br/>

after each one and they all seem to horizontal align center (even if I put some CSS that says left align).

Here is the CSS,

.radioLeft
{
    text-align:left;
}

Here is the HTML:

 <input checked="checked" class="radioLeft"  name="CalendarType" value="1" type="radio"><b>Person </b>(False) <br>
 <input checked="checked" class="radioLeft"  name="CalendarType" value="2" type="radio"><b>Event </b>(False) <br>
 <input checked="checked" class="radioLeft"  name="CalendarType" value="3" type="radio"><b>Release</b>(False) <br>
like image 458
leora Avatar asked Dec 16 '10 05:12

leora


3 Answers

You shouldn't apply this style to the radios but to the container they are on, in that case you can add a div:

<div class="radioLeft">
  <input checked="checked" name="CalendarType" value="1" type="radio"><b>Person </b>(False) <br>
   <input checked="checked" name="CalendarType" value="2" type="radio"><b>Event </b>(False) <br>
   <input checked="checked"  name="CalendarType" value="3" type="radio"><b>Release</b>(False) <br>
</div>
like image 147
foX092 Avatar answered Sep 29 '22 22:09

foX092


Try with the following CSS style.

.radioLeft input{
    text-align: left;
    display:inline;
}
like image 24
Vijender Reddy Avatar answered Sep 29 '22 21:09

Vijender Reddy


You should check the alignment of the container that surrounds them.

like image 43
Ivan Ivanic Avatar answered Sep 29 '22 23:09

Ivan Ivanic