-1

I have this html code

.......
<div class="list-rows> </div>
<div class="list-rows> </div>

<div class="cat-row"><span>Topics</span></div>
<div class="list-rows> </div>
<div class="list-rows> </div>
<div class="list-rows> </div>

Now i want to find all div with class list-rows but which come after this element <div class="cat-row"><span>Topics</span></div>

div.cat-row +list-rows is not working

peterh
  • 11,875
  • 18
  • 85
  • 108
kgill
  • 5
  • 1

3 Answers3

1

Use ~:

.cat-row ~ .list-rows {
    ...
}

See https://developer.mozilla.org/en-US/docs/Web/CSS/General_sibling_combinator

cheack
  • 394
  • 1
  • 6
1

Combining the comment and the two previous answers:

  • Most of the class= attributes are missing their closing quotation marks.
  • The CSS list-rows isn't preceded by a . to indicate that it is a class.
  • The + (next younger sibling) in the CSS should be tilde~ (all younger siblings).
Ray Butterworth
  • 588
  • 1
  • 3
  • 18
0

you need closing quotes on your class names in the html and you should use something like div.cat-row+.list-rows as a selector.

kpie
  • 9,588
  • 5
  • 28
  • 50