K213
K213

Reputation: 311

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

I have a WordPress plugin which 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

Upvotes: 0

Views: 118

Answers (1)

Suresh Ponnukalai
Suresh Ponnukalai

Reputation: 13978

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;
}

Upvotes: 2

Related Questions