1

I have two div and I want to apply some css on the first div that has no class or id .How can I do it ??

Html:

<div>some content</div>

<div class="text-1">
Mar
  • 53
  • 7

1 Answers1

4

You can use the :not() selector:

div:not([class]) {
  color: red;
}
<div>some content</div>

<div class="text-1">some more</div>

Basically this says select any div that doesn't have the class attribute.

disinfor
  • 10,865
  • 2
  • 33
  • 44