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.

Reply via email to