I'm currently working on a small login and register box that should stay fixed at the top of the page. However, I'm facing issues with changing the background color of the horizontal list when hovered over. Below is the code snippet:
/* Regbox */
ul#regbox{
width: auto;
position: fixed;
padding: 0;
float: left;
top: -15;
left: 0;
}
ul#regbox li{
list-style: none;
display: inline;
background-color: rgba(77, 77, 77, 1);
padding: 5px;
box-shadow: 5px 5px 5px #000000;
}
ul#regbox li:last-child{
border-bottom-right-radius: 5px;
}
ul#regbox li a{
text-decoration: none;
padding: 5px;
}
a:hover{
background-color: rgba(100, 100, 100, 0.5);
border-radius: 5px;
}
<div id="regbox">
<ul id="regbox">
<li><a href="">Login</a>
<li><a>|</a>
<li><a href="">Register</a>
</ul>
</div>
I am aiming for the list items to change their color on hover similar to this example:
ul#navigation{
width: 12px;
float: left;
padding: 0;
position: fixed;
}
ul#navigation li{
list-style: none;
background-color: rgba(77, 77, 77, 0.8);
float: left;
font-size: 20px;
margin: 0;
width: 70px;
}
ul#navigation li:last-child{
border-bottom-left-radius: 5px;
}
ul#navigation li:first-child{
border-top-left-radius: 5px;
}
ul#navigation li a{
display: block;
padding: 5px;
text-decoration: none;
}
a:link, a:visited{
color: rgb(0, 0, 0);
}
a:hover{
background-color: rgba(77, 77, 77, 0.5);
border-radius: 5px;
}
<nav>
<ul id="navigation">
<li><a href="main.html">Home</a>
<li><a href="store.html">Store</a>
<li><a href="about.html">About</a>
</ul>
</nav>
I've experimented with setting the display property to "block" on hover, but it resulted in breaking the list structure.
Your assistance on this matter would be greatly appreciated.
Thank you,
Ivar