I'm trying to make the border-bottom disappear on ".option 1" when you hover ".option 2".
I have read some of the questions on this matter and even tried an example by Nicholas King (http://jsfiddle.net/2NEgt/3/) which was an answer on this topic: CSS :hover on other element?
After changing his code I noticed that I can do this if I do it on the ".option1" to remove the border on ".option2" but the same cannot be seen if it is the other way around. Is there an explanation for this? Since they are both inside the same div they should be sibling elements or am I thinking wrong?
Would really appreciate an explanation on this matter and if possible a solution that doesn't require JS.
Thank you in advance.
https://jsfiddle.net/jhcv1462/1/
#nav_bar {
margin-left: auto;
margin-right: auto;
position: relative;
color: black;
display: flex;
flex-direction: row;
}
.nav {
width: 100%;
height: 50px;
transition: 0.33s;
text-align: center;
cursor: pointer;
}
.option1 {
border-bottom: 2px solid #4387ff;
}
.option2:hover {
border-bottom: 2px solid #4387ff;
}
.option2:hover+.option1 {
border: none;
}
<div id="nav_bar">
<div class="nav option1">
<h2>Option 1</h2>
</div>
<div class="nav option2">
<h2>Option 2</h2>
</div>
</div>