Forum Moderators: not2easy

Message Too Old, No Replies

css selector

         

piratefishfingers

11:55 am on Oct 9, 2009 (gmt 0)

10+ Year Member



form.formname p label
{
}

should be

form.formname p, form.formname label
{
}

is there a lazy way to do this?

form.formname (p, label)
{
}

thnx

D_Blackwell

3:52 pm on Oct 9, 2009 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



I'm not quite sure what you want to do, so guessing a bit. I'll start by describing what you have. (No lazy way to learn anything.)
.....................

1)

form.formname p label
{
color: red;
}

One or more <label>, inside one or more <p>, inside one or more <form>, with the class name of formname - will render text of the LABEL red.
.....................

2)

form.formname p, form.formname label
{
color: red;
}

One or more <p> and <label>, inside one or more <form>, with the class name of formname - will render text of the PARAGRAPH and LABEL red.
.....................

3)

form.formname (p, label)
{
}
This does nothing. The format is not valid. Validate your CSS as 'best practice.

[jigsaw.w3.org...]
.....................

4)

You may have been attempting the following with #3. Attribute Selectors have their place, but probably not appropriate for needs.
W3C - Attribute Selectors [w3.org]

choster

1:29 am on Oct 10, 2009 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



I think piratefishfingers is asking if there is a shorthand for selecting child elements of a common parent.

The answer is no. But properly cascaded, it's not exactly difficult to list multiple elements— it's not as if you have hundreds or thousands, or even dozens.