[Catalyst] Styling HTML::Widget elements

Scottsweep scottsweep at yahoo.com
Fri Apr 21 18:18:28 CEST 2006


You can't apply a style to the label tag itself if
you're using an embedded control otherwise it won't
render correctly (as you have seen). Instead you need
to style the label text (which defeats half the reason
for the label tag in the first place IMHO) 

This will keep the label to the left of the control:
<label>
    <span class="myclass">Username:</span>
    <input class="textfield" id="login_user"
name="user" type="text" />
</label>


This will keep the label to the right of the control:
<label>    
    <input class="textfield" id="login_user"
name="user" type="text" />
    Username
</label>


This will show the label above the control (any style
application, class or style attribute or #id in
stylesheet):
<label class="myclass" id="login_user_label"
for="login_user">
    Username:
    <input class="textfield" id="login_user"
name="user" type="text" />
</label>





More information about the Catalyst mailing list