Имеется некий html-код: <article class="news-article"> <header> <a href="#"><img src="img/news-img1.jpg" alt="" class="img-responsive"></a> <span class="date">12 Feb</span> </header> <div class="article-content"> <h3><a href="#">Amazing Image Post</a></h3> <p>By <span class="author">admin</span><span class="separator">|</span><span class="comm-num">2</span> comment</p> </div> </article> 

Is it possible to highlight a span with the class .date in the header of the article without the help of JS when hovering over a link in a block with a class .article-content?

  • one
    cannot be ........... - Jean-Claude
  • Just a crutch in style: position <header> after the div but position the styles above. - Alexey Shimansky
  • If you track the article: hover in its entirety - sercxjo

1 answer 1

CSS runs through the tag tree from top to bottom and outside to the inside. This is part of ideology, and it will probably remain so until the end of CSS’s life as a standard.

Therefore, to go to the ancestors, or to the neighbors to the current element - use js.