Will CSS attribute selector work to style this element?

Posted by morktron on Stack Overflow See other posts from Stack Overflow or by morktron
Published on 2010-05-03T07:25:18Z Indexed on 2010/05/03 7:28 UTC
Read the original article Hit count: 319

Filed under:
|

Hi, I have the following html:

<div class="bf_form_row">
    <label for="findout">Text goes here</label>
<textarea class="findOut" cols="40" id="findout" name="findout" rows="10"></textarea>
</div>

I trying to work out how to style the 'label' element without being able to change the html.

Ideally I'd like to style all 'label' elements that come before 'textarea' elements but I don't think it is possible using just CSS.

I thought this attribute selector would work:

label[for="findout"] {
    width: 100%;
}

but no, any ideas?

© Stack Overflow or respective owner

Related posts about css

Related posts about css-selectors