Unusual CSS Question

Associate
Joined
6 Jan 2006
Posts
1,024
Location
Midlands
I have the following HTML

<div>
<p class="hlight">text</p>
</div>

<div>
<p>text</p>
</div>

In my css, i would like if

div p.hlight {
style the div and NOT the p
}

can this be done?
 
As above, you can do that quite easily with jquery but not with css alone.

Alternatively, depending on what you're trying to do, you could probably just apply the styling directly to your p. It's a block element by default anyway, just like the div.

Can you let me know which part of jquery will allow me to do this?
 
why can't you do

Code:
<div class='highlightChildPs'>
<p>Some text</p>
</div>

div.highlightChildPs p
{
  // style rules
}

That will style the p and not the div!

The html is automatically generated and so i can not change it. I understand i can specify an class to the div and style it but i cant!
 
Back
Top Bottom