[Ruby] ruby on rails, formatting check_box
Frank Schwieterman
fschwiet at gmail.com
Thu Aug 2 00:43:16 PDT 2007
Hmm I take that back, Dave's suggestion worked but for an unexpected
reason. What determined whether or not IE7 allowed a line break between the
checkbox and the label was whether or not there was a newline in the RHTML
file between the <%=checkbox%> and the <label>. When the <%=checkbox> was
within the label, it allowed a newline when the HTML had a newline after the
<%=checkbox> before the label text.
Firefox allowed a linebreak in any case, so it seems I should look into
the CSS solution.
On 8/2/07, Frank Schwieterman <fschwiet at gmail.com> wrote:
>
> I tried dave's suggestoin (<label><%= checkbox>text</label>) and it does
> what I had hoped. I'm interested in trying the CSS approaches too, but I'm
> not sure how to add CSS to the <%= checkbox %>. I could bind the CSS to the
> element type, but then it would affect all element types. I could bind it
> to the element id, but then I'd be putting a dependency on the form helper's
> conventions for making up those names (which could change). I could bind it
> to the class name, but I don't know how to cause the <%= checkbox %> to have
> a particular class name.
>
> On 8/1/07, shane becker <veganstraightedge at gmail.com> wrote:
> >
> >
> > > Usually, it's best to wrap your input with the label, so:
> > > <label for='content_segment_needs_review'>
> > > <input id='content_segment_needs_review' name='content_segment
> > > [needs_review]' type='checkbox' value='1' />
> > > Needs review
> > > </label>
> >
> > i don't think that's the way it goes. i'm pretty sure it goes like this:
> >
> > <label for="your_face">Label</label>
> > <input id="your_face" name='your_mother[your_face]' value='1' />
> >
> > http://www.w3schools.com/tags/tag_label.asp
> >
> >
> > > To get line breaks to handle the way you want you, might try using
> > > some CSS,
> > > specifically: label{ white-space: nowrap }. Might work. Haven't
> > > tried it.
> >
> > white-space is a goofy attribute. i would give these two a try.
> > { display: inline }
> > { display: block }
> >
> >
> > good luck.
> > -shaners
> >
> >
> >
> >
> >
> > -----------
> > join the resistance. fall in love.
> > http://theresistancearmy.com
> >
> >
> > _______________________________________________
> > Ruby at zenspider.com - Seattle.rb non-commercial list
> > http://www.zenspider.com/seattle.rb
> > http://www.zenspider.com/mailman/listinfo/ruby
> >
>
>
More information about the Ruby
mailing list