K213 K213 - 5 months ago 9
CSS Question

How to add css to a HTML div which has no class or id

Hi I have a wordpress plugin wich creates an output like this:

<div>[Some Content]</div>
<div>[Some Content]</div>
<div>[Some Content]</div>
<div>[Some Content]</div>
<div>[Some Content]</div>
<div>[Some Content]</div>


All those div's have width:50% and a float:left; So I always have two in a row.

Now I need one div to be at 100% width.

How do I do that?

enter image description here

Answer

you can use nth-of-type() selector to target a particular div. But you should have some parent element.

#parentid div:nth-of-type(2)
{
  background:#ff0000;
}
Comments