I am interested in a way of making CSS(no javascript) show off a div
or an element outside of the one you :hover
, like so:
#divid {
display: none;
}
a:hover #divid {
display: block;
}
<a href="#">Hover me!</a>
<div id="divid">Hello there, fellow friend!</div>
I am pretty curious, because I want to make a thing while you hover a certain menu element, you will get the search bar drawn to the left edge of the browser(it'll be position: fixed;
).
EDIT:
The above code was not actually whatI wanted, I think.
This is the actual code, since it doesn't work anyways by the answers.
#fixed2 a:hover + .nav {
background: black;
}
#options:hover + #search_text {
position: fixed;
top: 0;
left: 0;
}
<ul class="nav">
<li id="left" class="big">
<a href="#">
<img width="35px" src="square.png" />
</a>
</li>
<li id="left" class="arrow">
<a href="#">
<img src="arrow.png" />
</a>
</li>
<li id="left">
<a href="#">
<img width="17px" style="margin-left: -7px" src="refresh.png" />
</a>
</li>
<li id="left">
<a href="#">
<img width="18px" style="opacity: 0.94; margin-top: -1px;" src="help.png" />
</a>
</li>
<div id="fixed">
<li id="search">
<form action="" method="get">
<input type="text" name="search_text" id="search_text" placeholder="Search" />
<input type="button" name="search_button" id="search_button">
</form>
</li>
</div>
<div id="fixed2">
<li class="icn" id="options">
<a href="#">
<img width="25px" src="settings.png" />
</a>
</li>
</div>
</ul>
Why doesn't it work properly and just actually work?