tags:

views:

45

answers:

2

Code:

<label for="email">{t _your_email}:</label>

CSS:

label
{
    display: block;
    width: 156px;
    cursor: pointer;
    padding-right: 6px;
    padding-bottom: 1px;
}

I want to make a new CSS for the email label as it's not meant to be that wide.. Just can't think right now :P

Thanks.

+6  A: 

The selector would be

label[for=email]
{
    /* ...definitions here... */
}

It's an attribute selector. Note that some browsers (versions of IE < 8, for instance) may not support attribute selectors, but more recent ones do. To support older browsers like IE6 and IE7, you'd have to use a class (well, or some other structural way), sadly.

(I'm assuming that the template {t _your_email} will fill in a field with id="email". If not, use a class instead.)

T.J. Crowder
Thanks, worked like a charm.
Kyle Sevenoaks
I'll change it to a class for ie7 using conditiona comments then, thanks for the great answer!
Kyle Sevenoaks
+3  A: 

Maybe just add some class="email" param for your <label> and in CSS do label.email

hsz
Yeah, since even IE7 doesn't support attribute selectors. *sigh*
T.J. Crowder
Damn IE. Our jobs would be much simpler if that browser just didn't exist. Thanks.
Kyle Sevenoaks
@Kyle: :-) Yes and no. Remember, it was the IE team that created the `XmlHTTPRequest` object and the `innerHTML` property, both pretty darned good innovations that have since (finally) made it into the standard. I'm not saying that they haven't completely used up that karma (they have, and then some..and then some more), I'm just saying...
T.J. Crowder
That's very true. But by that logic, they have a hell of a lot of making up to do. IE9 had better be properly standards compliant AND force updates to ALL IE users.. If only..
Kyle Sevenoaks