this is my 1st post over here, ill try to be as clear as possible and hope I'm following the site's rules.
Not so long ago I started to play a little bit with some HTML/CSS, I got pretty good at it but not enough I guess and I hope to get some help over here.
I'm trying to build a navigation menu and one of it's features I would like it to have is when I hover over the "Account" button it should split the menu in the middle and show a new section where the user can log-in into his or hers account.
This is what I got so far and for some reason I cant make the effect when hovering over the "Account" div
but it doe's work when I apply the hover effect on the entire top div
(where the "Account div
is a part of). tried all "linking" methods suggested in this post and still nothing... Also last thing: When i did overflow: hidden;
on the .middle div
it added a space between the top and bottom divs
.
I would highly appreciate any help and if it's possible to leave it at the CSS level (without any jQuery or any other coding)
Thanks in advance, Tony.
.container {
width: 560px;
height: auto;
}
.top {
height: 50px;
background-color: red;
}
.top-L {
float: right;
padding: 5px 20px;
}
.top-R {
float: right;
padding: 5px 20px;
height: 50px;
display: block;
}
.middle {
height: 0px;
width: 560px;
overflow: hidden;
background-color: blue;
transition: .4s ease;
}
.bottom {
height: 50px;
background-color: green;
}
.top:hover + .middle {
height: 50px;
transition: .4s ease;
}
.middle:hover {
height: 50px;
}
<html>
<body style="font-family: sans-serif; background-color: #ccc;">
<link href="https://maxcdn.bootstrapcdn.com/font-awesome/4.6.3/css/font-awesome.min.css" rel="stylesheet"/>
<div class="container">
<div class="top">
<div class="top-L">Other</div>
<div class="top-R">Account</div>
</div>
<div class="middle">
<div>
<input type="text" placeholder="Enter Username" name="uname" required>
<input type="password" placeholder="Enter Password" name="psw" required>
</div>
</div>
<div class="bottom"></div>
</div>
</body>
</html>