Streaming live at 10am (PST)

Adjacent Sibling Selector Review


#1

Hi guys,

i hope you can help. I wonder if this solution is still supposed to be working (custom code with unique id’s):

I ask because i tried it and i can not make it work.

Best regards
Sebastian


#2

Yes it should work - this is regular CSS. Add url / example.

“adjacent” means “immediately following”.
https://www.w3schools.com/cSS/tryit.asp?filename=trycss_sel_element_plussMo

immediately - so check again if in your site tree #div1 is after #div2 "immediately "

Good

<div id="div1"></div>
<div id="div2"></div>

“bad”

    <div id="div1"></div>
     <p>now #div2 not immediately after #div1</p>
    <div id="div2"></div>

“bad2”

    <div id="div1">
        <div id="div2">i am child not sibling</div>
  </div>

#3

Thank you!! That helped, plus i had to find out that it only works in the published site and not in the preview.


#4

Yes of course. Like any other custom code. Great :slight_smile: Mark as solve to close this issue. Thanks


#5

This topic was automatically closed 125 days after the last reply. New replies are no longer allowed.