alexZ
alexZ

Reputation: 189

rails radio_button and label in two different lines

I'm pretty new to CSS.

I'm having radio buttons in my app

<%= f.radio_button :gender, true %> <%= f.label :gender, "Male" %>        
<%= f.radio_button :gender, false%> <%= f.label :gender, "Female" %>

but the page show the radio button and label in two different lines, like

O
Male
O
Female

How can I make it at the same line? Like

  O Male
  O Female

Thanks

With

input[type="radio"], label{
     float:left;
}
label{
 clear:left;
}

The page looks like

O
Male O
Female

Tried several different browser and the same.

Upvotes: 2

Views: 2209

Answers (2)

fuzzygroup
fuzzygroup

Reputation: 1149

I found this CSS to be better since it didn't jam the radio button and the text together.

input[type="radio"], label{
     float:left; margin-left: 5px;
    }
input{
 clear:left;;
}

Upvotes: 0

sandeep
sandeep

Reputation: 92803

write like this in your css:

input[type="radio"], label{
 display:inline-block;
 *display:inline/*For IE7*/
 *zoom:1;
}

UPDATED

Write like this:

input[type="radio"], label{
     float:left;
    }
input{
 clear:left;
}

Check this http://jsfiddle.net/nuyqd/

Upvotes: 5

Related Questions