Thanks for the feedbacks. And yes unfortunately I am bound to support our "official corporate browser" IE6, otherwise I would have happily gone to a more CSS-only direction. What puzzles me most is that method BoundField.label_tag() has an attr(ibute)s argument and some code to support it, but there is no easy way to call it (unable to pass arguments to methods in templates).
For the time being, I will go with my initial idea (subclassing my own Widget/Renderer classes to provide <label> rendering with custom css), leaving Field's <label> HTML definition as is. I would however appreciate easy/lazy ways to customize attributes on a Field's <label>, e.g for common CSS patterns where the <label> automatically gets "required" or "error" CSS classes depending on the Field's validation options. On 26 mar, 15:28, David De La Harpe Golden <david.delaharpe.gol...@ichec.ie> wrote: > On 26/03/10 13:18, Thierry wrote: > > > Hi, > > > I want to differentiate CSS style of fields<label> from the style of > > RadioSelects<label> elements (as rendered through > > RadioFieldRenderer). > > Immediate action: I could create my RadioFieldRenderer/RadioInput > > classes to display inner labels as<label class="foo">. > > > Any direction you could give me? Thanks in advance. > > Well, not a general solution for element attributes, but do bear in mind > that css selectors (and jquery's selectors for that matter) can be a bit > more than just the basic "element" ".class" and "#id" that you always see. > > See e.g.http://www.w3.org/TR/css3-selectors/(or css2) > > So, you can style django's simple builtin form outputs somewhat more > aggressively than you might realise if you're not up on css, without > having to subclass to override outputs, if you _wrap_ the output in > something for css to match. [If your requirements include "support > ancient versions of MSIE" you might find said ancient versions' css > handling a bit annoying though] > > Vague example: > > <html> > <head> > <style type="text/css"> > div.form_wrapper > label { background-color: #ff0000 } > div.form_wrapper label { color: #0000ff } > div.form_wrapper > label:first-child { color: #00ff00 } > div.form_wrapper > label:nth-child(3) { color: #ffff00 } > </style> > </head> > <body> > <div class="form_wrapper"> > <label>FOO</label> > <div class="moocow"> > <label>BAR</label> > </div> > <label>BAZ</label> > <label>MOO</label> > </div> > </body> > </html> -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-us...@googlegroups.com. To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-users?hl=en.