CSS width transition out not working - html

Below is the HTML and CSS I'm using. Unfortunately the questions already asked do not give the answer required. Basically it decreases the width of all siblings and increases the one that is hovered over. I'm using ease-in-out but the OUT part of the transition just instantaneously jumps back to its original state.
html {
background: #000066;
}
body {
height: 100%;
background: #cfcfd0;
margin: 4% 4% 4% 4%;
}
#title {
background: ;
text-align: center;
margin: 2% 2%;
padding: 2% 2%;
}
#nav {
width: 90%;
overflow: auto;
margin: 0 auto;
padding: 0px 0px 0px 0px
}
ul {
margin: 4% auto;
padding: 0;
width: 100%;
list-style-type: none;
overflow: auto;
}
li {
box-sizing: border-box;
text-align: center;
display: inline-block;
float: left;
width: 33.33%;
padding: 2% 0;
margin: 0%;
background: blue;
border-top: 1px solid black;
border-bottom: 1px solid black;
border-right: 1px solid black;
}
li:first-child {
border-left: 1px solid black;
}
li:last-child {
border-right: 1px solid black;
}
a {
color: black;
text-decoration: none;
}
ul:hover > li:hover {
width: 37.33%;
color: white;
background: darkblue;
-webkit-transition: all 300ms ease-in-out;
-moz-transition: all 300ms ease-in-out;
-ms-transition: all 300ms ease-in-out;
-o-transition: all 300ms ease-in-out;
transition: all 300ms ease-in-out;
}
ul:hover > li {
width: 31.33%;
-webkit-transition: width 300ms ease-in-out;
-moz-transition: width 300ms ease-in-out;
-ms-transition: width 300ms ease-in-out;
-o-transition: width 300ms ease-in-out;
transition: width 300ms ease-in-out;
}
<div id="title">
<h1>Projects Home</h1>
</div>
<div id="nav">
<ul>
<li>Project 1
</li>
<li>Project 2
</li>
<li>Project 3
</li>
</ul>
</div>
I can't figure out why this is.

Any CSS property gets applied to an element only when the selector is matched. When transition property is specified under the :hover selector, they naturally get applied only when the hover is on. When we hover out, they just snap back because the transition setting is no longer applicable for the element.
In your case, since transition is specified only within ul:hover > li:hover and ul:hover > li it gets applied only when the mouse is over an li or when the mouse is atleast over the ul (that is when we are moving from one li to another while still being inside the ul boundaries).
To get the transition to work properly even during mouse out, it should be specified within the li selector like in the below snippet.
html {
background: #000066;
}
body {
height: 100%;
background: #cfcfd0;
margin: 4% 4% 4% 4%;
}
#title {
background: ;
text-align: center;
margin: 2% 2%;
padding: 2% 2%;
}
#nav {
width: 90%;
overflow: auto;
margin: 0 auto;
padding: 0px 0px 0px 0px
}
ul {
margin: 4% auto;
padding: 0;
width: 100%;
list-style-type: none;
overflow: auto;
}
li {
box-sizing: border-box;
text-align: center;
display: inline-block;
float: left;
width: 33.33%;
padding: 2% 0;
margin: 0%;
background: blue;
border-top: 1px solid black;
border-bottom: 1px solid black;
border-right: 1px solid black;
-webkit-transition: all 300ms ease-in-out;
-moz-transition: all 300ms ease-in-out;
-ms-transition: all 300ms ease-in-out;
-o-transition: all 300ms ease-in-out;
transition: all 300ms ease-in-out;
}
li:first-child {
border-left: 1px solid black;
}
li:last-child {
border-right: 1px solid black;
}
a {
color: black;
text-decoration: none;
}
ul:hover > li:hover {
width: 37.33%;
color: white;
background: darkblue;
}
ul:hover > li {
width: 31.33%;
}
<div id="title">
<h1>Projects Home</h1>
</div>
<div id="nav">
<ul>
<li>Project 1
</li>
<li>Project 2
</li>
<li>Project 3
</li>
</ul>
</div>

Remove the > on ul:hover > li to ul:hover li:
html {
background: #000066;
}
body {
height: 100%;
background: #cfcfd0;
margin: 4% 4% 4% 4%;
}
#title {
background: ;
text-align: center;
margin: 2% 2%;
padding: 2% 2%;
}
#nav {
width: 90%;
overflow: auto;
margin: 0 auto;
padding: 0px 0px 0px 0px
}
ul {
margin: 4% auto;
padding:0;
width: 100%;
list-style-type: none;
overflow: auto;
}
li {
box-sizing: border-box;
text-align: center;
display: inline-block;
float:left;
width: 33.33%;
padding: 2% 0;
margin: 0%;
background: blue;
border-top: 1px solid black;
border-bottom: 1px solid black;
border-right: 1px solid black;
}
li:first-child {
border-left: 1px solid black;
}
li:last-child {
border-right: 1px solid black;
}
a {
color: black;
text-decoration: none;
}
ul:hover > li:hover{
width: 37.33%;
color: white;
background: darkblue;
-webkit-transition: all 300ms ease-in-out;
-moz-transition: all 300ms ease-in-out;
-ms-transition: all 300ms ease-in-out;
-o-transition: all 300ms ease-in-out;
transition: all 300ms ease-in-out;
}
ul:hover li {
width: 31.33%;
-webkit-transition: width 300ms ease-in-out;
-moz-transition: width 300ms ease-in-out;
-ms-transition: width 300ms ease-in-out;
-o-transition: width 300ms ease-in-out;
transition: width 300ms ease-in-out;
}
<div id= "title">
<h1>Projects Home</h1>
</div>
<div id= "nav">
<ul>
<li>Project 1</li>
<li>Project 2</li>
<li>Project 3</li>
</ul>
</div>

Related

How to Create a Smooth Dropping Animation in CSS?

I am trying to create a smooth animation of my nav-bar in CSS here's my HTML Code-
<body>
<nav class="navbar">
<ul class="nav-list another">
<li><n>Engine</n></li>
<li>Home</li>
<li>About</li>
<li>Contact Us</li>
<li><button type="button" id="mysearch">More</button></li>
</ul>
</nav>
<hr>
</body>
</html>
Here's my CSS Code-
*{
margin: 0;
padding: 0;
}
html{
background-color: white;
background-image: url("img/ManHattanImage.webp");
}
li{
align-items: left;
width: 100px;
height: 100%;
display: inline-block;
margin-right: 170px;
font-size: 20px;
/* background-color: black; */
color: black;
font-size: 20px;
}
hr{
color: black;
margin-top: 30px;
}
n{
/* background-color: black; */
color: white;
font-size: 40px;
font-style: bold;
font-family: "Lucida Console", "Courier New", monospace;
margin-left: 20px;
margin-top: 30px;
}
a {
text-decoration: none;
color: white;
}
a:visited { text-decoration: none; }
a:hover {
text-decoration: none;
/* background-color: black; */
}
a:focus { text-decoration: none; }
a:hover, a:active { text-decoration: none; }
nav:hover{
height:300px;
}
I want a clean Animation like of a good dropdown menu navbar and with clear overlaps, Also I may add some more elements inside the navbar (With Further Updates)?
This is how to make a dropdown menu but I'm not sure how to do an animation. I hope this is what you meant by the dropdown menu.
<!DOCTYPE html>
<html>
<head>
<meta name="viewport" content="width=device-width, initial-scale=1">
<style>
.dropbtn {
background-color: #ac0d0d;
color: white;
padding: 16px;
font-size: 16px;
border: none;
}
.dropdown {
position: relative;
display: inline-block;
}
.dropdown-content {
display: none;
position: absolute;
background-color: #ffffff;
min-width: 160px;
box-shadow: 0px 8px 16px 0px rgba(0,0,0,0.2);
z-index: 1;
}
.dropdown-content a {
color: rgb(18, 19, 85);
padding: 12px 16px;
text-decoration: none;
display: block;
}
.dropdown-content a:hover {background-color: #ddd;}
.dropdown:hover .dropdown-content {display: block;}
.dropdown:hover .dropbtn {background-color: #ac0d0d;}
</style>
</head>
<body>
<div class="dropdown">
<button class="dropbtn">Dropdown menu</button>
<div class="dropdown-content">
first
second
third
</div>
</div>
</body>
</html>
Animation Drop down menu on hover
<!DOCTYPE html>
<html>
<head>
<meta name="viewport" content="width=device-width, initial-scale=1">
<style>
nav {
width: 100%;
height: 80px;
background: #222;
}
ul {
text-align: center;
}
ul li {
font: 13px Verdana, 'Lucida Grande';
cursor: pointer;
-webkit-transition: padding .05s linear;
-moz-transition: padding .05s linear;
-ms-transition: padding .05s linear;
-o-transition: padding .05s linear;
transition: padding .05s linear;
}
ul li.drop {
position: relative;
}
ul > li {
display: inline-block;
}
ul li a {
line-height: 80px;
padding: 0 20px;
height: 80px;
color: #777;
-webkit-transition: all .1s ease-out;
-moz-transition: all .1s ease-out;
-ms-transition: all .1s ease-out;
-o-transition: all .1s ease-out;
transition: all .1s ease-out;
}
ul li a:hover {
color: #eee;
}
.dropOut .triangle {
width: 0;
height: 0;
position: absolute;
border-left: 8px solid transparent;
border-right: 8px solid transparent;
border-bottom: 8px solid white;
top: -8px;
left: 50%;
margin-left: -8px;
}
.dropdownContain {
width: 160px;
position: absolute;
z-index: 2;
left: 50%;
margin-left: -80px; /* half of width */
top: -400px;
}
.dropOut {
width: 160px;
background: white;
float: left;
position: relative;
margin-top: 0px;
opacity: 0;
-webkit-border-radius: 4px;
-moz-border-radius: 4px;
border-radius: 4px;
-webkit-box-shadow: 0 1px 6px rgba(0,0,0,.15);
-moz-box-shadow: 0 1px 6px rgba(0,0,0,.15);
box-shadow: 0 1px 6px rgba(0,0,0,.15);
-webkit-transition: all .1s ease-out;
-moz-transition: all .1s ease-out;
-ms-transition: all .1s ease-out;
-o-transition: all .1s ease-out;
transition: all .1s ease-out;
}
.dropOut ul {
float: left;
padding: 10px 0;
}
.dropOut ul li {
text-align: left;
float: left;
width: 125px;
padding: 12px 0 10px 15px;
margin: 0px 10px;
color: #777;
-webkit-border-radius: 4px;
-moz-border-radius: 4px;
border-radius: 4px;
-webkit-transition: background .1s ease-out;
-moz-transition: background .1s ease-out;
-ms-transition: background .1s ease-out;
-o-transition: background .1s ease-out;
transition: background .1s ease-out;
}
.dropOut ul li:hover {
background: #f6f6f6;
}
ul li:hover a { color: white; }
ul li:hover .dropdownContain { top: 65px; }
ul li:hover .underline { border-bottom-color: #777; }
ul li:hover .dropOut { opacity: 1; margin-top: 8px; }
</style>
<body>
<nav>
<ul>
<li class="drop">
You
<div class="dropdownContain">
<div class="dropOut">
<div class="triangle"></div>
<ul>
<li>Plan</li>
<li>Account Settings</li>
<li>Switch Account</li>
<li>Sign Out</li>
</ul>
</div>
</div>
</li>
</ul>
</nav>
</body>
</html>

Extra space next to menu?

I have a menu that spans across the page. I have its wrapper set to 100% and correctly, it spans completely across its container. I have for menu items set at 25% each however, there is around 20px space to the left of the menu revealing the background color. Regardless of sizes and margin:0 auto, the space remains.
.center{
margin:0 auto;
width:100%;
height:100%;
background-color:#3c87bc;
padding:0;
}
#top_forums_menu{
width:100%;
height:24px;
background-color:#5dbcff;
position:relative;
}
ul#top_forums_menu_bars {
list-style-type: none;
margin:0 auto;
}
ul#top_forums_menu_bars li {
float: left;
width:25%;
height: 100%;
overflow:hidden;
-webkit-box-shadow: 0 6px 2px -4px black;
-moz-box-shadow: 0 6px 2px -4px black;
box-shadow: 0 6px 2px -4px black;
transition: all .25s ease-in-out;
-moz-transition: all .25s ease-in-out;
-webkit-transition: all .25s ease-in-out;
}
ul#top_forums_menu_bars li:hover{
border-bottom:5px solid #3a5871;
}
ul#top_forums_menu_bars li a{
display: inline-block;
width: 100%;
height: 100%;
opacity:1;
text-decoration:none;
transition: opacity .5s ease-in-out;
-moz-transition: opacity .5s ease-in-out;
-webkit-transition: opacity .5s ease-in-out;
line-height:10px;
padding-top:7px;
text-align:center;
font-family: Tahoma, Verdana, Segoe, sans-serif;
font-size:12px;
color:white;
}
ul#top_forums_menu_bars li a:hover {
opacity:.8;
}
<div id='top_forums_menu'>
<div class='center'>
<ul id='top_forums_menu_bars'>
<li><a href='' style='background-color:#5dbcff;'>Profile</a></li>
<li><a href='' style='background-color:#5dbcff;'>Account Settings</a></li>
<li><a href='' style='background-color:#5dbcff;'>My Content</a></li>
<li><a href='' style='background-color:#5dbcff;'>MyOACH</a></li>
</ul>
</div>
</div>
<ul> has a default padding which can be removed with the following rule:
ul#top_forums_menu_bars
{
padding-left: 0;
}
Just remove the left-padding
ul#top_forums_menu_bars {
list-style-type: none;
margin: 0 auto;
padding-left: 0;
}
https://jsfiddle.net/36ywxtyk/4/
The problem is that <ul> elements (along with <menu> and <dir> elements have a built-in browser rendering of padding-start: 40px. This is what is causing the offset that you see.
The easiest way to resolve this is to explicitly give your ul#top_forums_menu_bars a padding of 0, as can be seen in the following:
.center {
margin: 0 auto;
width: 100%;
height: 100%;
background-color: #3c87bc;
padding: 0;
}
#top_forums_menu {
width: 100%;
height: 24px;
background-color: #5dbcff;
position: relative;
}
ul#top_forums_menu_bars {
list-style-type: none;
margin: 0 auto;
padding: 0;
}
ul#top_forums_menu_bars li {
float: left;
width: 25%;
height: 100%;
overflow: hidden;
-webkit-box-shadow: 0 6px 2px -4px black;
-moz-box-shadow: 0 6px 2px -4px black;
box-shadow: 0 6px 2px -4px black;
transition: all .25s ease-in-out;
-moz-transition: all .25s ease-in-out;
-webkit-transition: all .25s ease-in-out;
}
ul#top_forums_menu_bars li:hover {
border-bottom: 5px solid #3a5871;
}
ul#top_forums_menu_bars li a {
display: inline-block;
width: 100%;
height: 100%;
opacity: 1;
text-decoration: none;
transition: opacity .5s ease-in-out;
-moz-transition: opacity .5s ease-in-out;
-webkit-transition: opacity .5s ease-in-out;
line-height: 10px;
padding-top: 7px;
text-align: center;
font-family: Tahoma, Verdana, Segoe, sans-serif;
font-size: 12px;
color: white;
}
ul#top_forums_menu_bars li a:hover {
opacity: .8;
}
<div id='top_forums_menu'>
<div class='center'>
<ul id='top_forums_menu_bars'>
<li><a href='' style='background-color:#5dbcff;'>Profile</a></li>
<li><a href='' style='background-color:#5dbcff;'>Account Settings</a></li>
<li><a href='' style='background-color:#5dbcff;'>My Content</a></li>
<li><a href='' style='background-color:#5dbcff;'>MyOACH</a></li>
</ul>
</div>
</div>
Alternatively, you could apply a global low-specificity rule of:
* {
margin: 0;
padding: 0;
}
This will override all of the browser padding / margin quirks, while still having a low enough specificity for any individual selectors to override these rules.

CSS Force nested child behind parent with position:fixed

I have a fixed menu bar that contains a simple <ul> <li> menu system. Upon li:hover I have a sub-menu system aside appear, and this is relative to each li. Unfortunately this aside is always appearing on top of all of the parents.
When I actually want it to be positioned behind the div#sidebar. Is this possible? I have not had much luck with z-index (including -1), any help would be appreciated!
<div id="sidebar">
<nav class="secondary">
<h2>Featured</h2>
<ul>
<li>
<a href="#">
<h3>Title</h3>
</a>
<aside class="article-card">
<h4>TITLE</h4>
<h5>TEXT</h5>
</aside>
</li>
</ul>
</nav>
</div>
ul {
list-style: none;
display: inline-block;
width: 59.6%;
margin-right: 9.1%;
float: right;
margin-bottom: 40px;
}
li {
display: block;
margin-bottom: 10px;
-webkit-transition: all 1s ease-in-out;
-moz-transition: all 1s ease-in-out;
-ms-transition: all 1s ease-in-out;
-o-transition: all 1s ease-in-out;
transition: all 1s ease-in-out;
}
#sidebar {
background: #253e40;
color: #8b8c91;
width: 215px;
height: 100%;
position: fixed;
top: 0;
bottom: 0;
right: 215px;
margin-right: -215px; /* "#sidebar" width */
z-index: 3;
}
#sidebar.active { margin-right: 0; }
#sidebar header {
font-weight: bold;
padding: 30px 20px 50px 20px;
border-bottom: 1px solid #8b8c91;
color: #8b8c91;
}
#sidebar footer {
background: none;
bottom: 40px;
padding: 0 20px;
position: absolute;
}
/* Nav */
#sidebar nav {
width: 100%;
margin: 20px 0 50px 0;
display: inline-block;
}
#sidebar ul {
width: 100%;
margin: 0;
}
#sidebar li {
margin-bottom: 0;
padding: 2px 20px;
}
#sidebar li:before {
content: none;
padding: 0;
}
.current-menu-item {
font-weight: bold;
color: #fff;
}
#sidebar a:hover {
color: #fff;
}
#sidebar nav.secondary h2 {
font-weight: bold;
color: #fff;
padding: 0 20px 15px 20px;
border-bottom: 1px solid #8b8c91;
}
#sidebar nav.secondary li {
padding: 15px 20px;
border-bottom: 1px solid #8b8c91;
}
#sidebar nav.secondary li:hover {
background: #252f37;
color: #fff;
}
/* Article Card Popout */
.article-card {
position: absolute;
background-color: #44484f;
display: inline-block;
width: 200px;
height: auto;
right: 15px;
border-left: 5px solid #be572b;
}
#sidebar nav.secondary li:hover .article-card {
right: 215px;
}
.article-card h4 {
font-weight: bold;
padding: 10px;
}
.article-card h5 {
color: #fff;
padding: 10px;
}
/* Transition animations */
#sidebar,
.article-card {
-webkit-transition: all 0.7s ease-in-out;
-moz-transition: all 0.7s ease-in-out;
-ms-transition: all 0.7s ease-in-out;
-o-transition: all 0.7s ease-in-out;
transition: all 0.7s ease-in-out;
}
Fiddle
If you really want to keep that html, you need to create a new stacking context. #sidebar has position:fixed - elements inside sidebar are treated with a new stacking context that now begins at #sidebar and not at body level any more.
Children of the sidebar cannot be positioned below #sidebar.
To solve this add another container inside sidebar that contains all the background styling and is inside the same stacking context as your slideout.
ul {
list-style: none;
display: inline-block;
width: 59.6%;
margin-right: 9.1%;
float: right;
margin-bottom: 40px;
}
li {
display: block;
margin-bottom: 10px;
-webkit-transition: all 1s ease-in-out;
-moz-transition: all 1s ease-in-out;
-ms-transition: all 1s ease-in-out;
-o-transition: all 1s ease-in-out;
transition: all 1s ease-in-out;
}
#sidebar {
background: #253e40;
color: #8b8c91;
width: 215px;
height: 100%;
position: fixed;
top: 0;
bottom: 0;
right: 215px;
margin-right: -215px; /* "#sidebar" width */
z-index: 3;
}
#sidebar.active { margin-right: 0; }
.sidebar-content {
height: 100%;
background: #253e40;
}
#sidebar header {
font-weight: bold;
padding: 30px 20px 50px 20px;
border-bottom: 1px solid #8b8c91;
color: #8b8c91;
}
#sidebar footer {
background: none;
bottom: 40px;
padding: 0 20px;
position: absolute;
}
/* Nav */
#sidebar nav {
width: 100%;
margin: 20px 0 50px 0;
display: inline-block;
}
#sidebar ul {
width: 100%;
margin: 0;
}
#sidebar li {
margin-bottom: 0;
padding: 2px 20px;
}
#sidebar li:before {
content: none;
padding: 0;
}
.current-menu-item {
font-weight: bold;
color: #fff;
}
#sidebar a:hover {
color: #fff;
}
#sidebar nav.secondary h2 {
font-weight: bold;
color: #fff;
padding: 0 20px 15px 20px;
border-bottom: 1px solid #8b8c91;
}
#sidebar nav.secondary li {
padding: 15px 20px;
border-bottom: 1px solid #8b8c91;
}
#sidebar nav.secondary li:hover {
background: #252f37;
color: #fff;
}
/* Article Card Popout */
.article-card {
position: absolute;
z-index: -1; // z index put's it below .sidebar-content
background-color: #44484f;
display: inline-block;
width: 200px;
height: auto;
right: 15px;
border-left: 5px solid #be572b;
}
#sidebar nav.secondary li:hover .article-card {
right: 215px;
}
.article-card h4 {
font-weight: bold;
padding: 10px;
}
.article-card h5 {
color: #fff;
padding: 10px;
}
/* Transition animations */
#sidebar,
.article-card {
-webkit-transition: all 0.7s ease-in-out;
-moz-transition: all 0.7s ease-in-out;
-ms-transition: all 0.7s ease-in-out;
-o-transition: all 0.7s ease-in-out;
transition: all 0.7s ease-in-out;
}
<div id="sidebar">
<div class="sidebar-content">
<nav class="secondary">
<h2>Featured</h2>
<ul>
<a href="#">
<li>Title
<aside class="article-card">
<h4>TITLE</h4>
<h5>TEXT</h5>
</aside>
</li>
</a>
</ul>
</nav>
</div>
</div>

add an effect when nav menu is displayed from hover

I need to add an effect for my mobile where the menu is display smoothly when the navigation button is hovered.
what I need is that the menu should display with ease not sudden appearance and if its possible not to adjust the content of my site like overlapping the content above if plausible
CSS
.menuimg:hover + #navcontainer {
display: block;
height: auto;
}
#navcontainer:hover {
display: block;
height: auto;
}
.children {
display: none;
}
#navcontainer {
position: relative;
z-index: 1;
display: block;
float: none;
width: 100%;
height: 20px;
list-style: none;
text-align: center;
}
.menu {
display: inline-block;
float: left;
width: auto;
text-align: left;
}
#navcontainer ul {
overflow: hidden;
margin: 0;
padding: 0;
list-style-type: none;
text-align: left;
}
#navcontainer ul li {
display: block;
float: left;
margin-left: 0;
padding: 0 6px;
}
#navcontainer ul li a {
display: block;
width: 100%;
padding: .2em 1em;
text-decoration: none;
color: #694a31;
border-top: 1px solid transparent;
border-right: 1px solid transparent;
border-left: 1px solid transparent;
background-color: transparent;
}
#navcontainer ul li ul li {
display: block;
float: none;
width: auto;
margin-left: 0;
border-top: 1px solid #e3d7be;
background: #edebd7;
}
#navcontainer ul li ul li a {
opacity: 1 !important;
color: #724e32;
border-top: 0 !important;
border-right: 0 !important;
border-left: 0 !important;
-webkit-border-radius: 0 0 0 0 !important;
-moz-border-radius: 0 0 0 0 !important;
border-radius: 0 0 0 0 !important;
background: transparent !important;
background-color: transparent !important;
}
#navcontainer li:hover ul,
#navcontainer li:active ul {
display: block;
}
#navcontainer ul li:hover a {
opacity: .5;
color: #724e32;
border-top: 1px solid #694b0a;
border-right: 1px solid #694b0a;
border-left: 1px solid #694b0a;
-webkit-border-radius: 5px 5px 0 0;
-moz-border-radius: 5px 5px 0 0;
border-radius: 5px 5px 0 0;
background-color: #edebd7;
}
#navcontainer ul li a:hover {
color: #fff;
background-color: #d3c096;
}
#navcontainer li:hover ul.children,
#navcontainer li:active ul.children {
position: absolute;
z-index: 300;
top: auto;
overflow: visible;
width: auto;
height: auto;
padding: 5px;
white-space: nowrap;
color: #724e32;
border-right: 1px solid #694b0a;
border-bottom: 1px solid #694b0a;
border-left: 1px solid #694b0a;
-webkit-border-radius: 0 0 5px 5px;
-moz-border-radius: 0 0 5px 5px;
border-radius: 0 0 5px 5px;
background: #edebd7;
}
#navcontainer ul li ul li:hover {
margin-left: 0;
color: #fff;
background-color: #d3c096;
}
#navcontainer ul li ul li a:hover {
margin-left: 0;
color: #fff;
background-color: #d3c096;
}
#navcontainer ul li ul li:hover a {
color: #fff;
background-color: transparent;
}
I want is to appear my menu at easy like from fading transition when i hovered on the navigation button
http://prntscr.com/4yverw
i have tested my css on fiddle its working fine there but when i transfer it to my site the menu transition doesn't work change and addeds some
.menu { display:none > opacity:0
-webkit-transition: opacity 0.5s ease-in-out;
-moz-transition: opacity 0.5s ease-in-out;
-o-transition: opacity 0.5s ease-in-out;
-ms-transition: opacity 0.5s ease-in-out;
transition: opacity 0.5s ease-in-out;}
.menuimg:hover + .menu
{
display: block; height: auto; opacity: 1;
-webkit-transition: opacity 0.5s ease-in-out;
-moz-transition: opacity 0.5s ease-in-out;
-o-transition: opacity 0.5s ease-in-out;
-ms-transition: opacity 0.5s ease-in-out;
transition: opacity 0.5s ease-in-out;
}.menu:hover
{
opacity: 1;
-webkit-transition: opacity 0.5s ease-in-out;
-moz-transition: opacity 0.5s ease-in-out;
-o-transition: opacity 0.5s ease-in-out;
-ms-transition: opacity 0.5s ease-in-out;
transition: opacity 0.5s ease-in-out; display: block; height: auto;
}
http://jsfiddle.net/xeqcx1zL/1/ - workign trasition
i changed the code
original code
.menuimg:hover + #navcontainer
#navcontainer:hover
to this
.menuimg:hover + .menu
.menu:hover
I have now my transition menu the only problem is that since i remove the display:none; the menu is always their but you cant see it since its on opacity:0; i want to hide it so it doesnt eats a space on my site, but using the display none and block css the transition wont work.
the menu is displayed under the button but you cant see it. it should be activated if you hover your mouse on the button.
http://prntscr.com/4z4jah

How to add transition time to underline hover effect

Okay , what i am asking is really lame ( i know a lot of css )
but here is my problem -
i have some text which i want to get an underline on hover , but the underline appears on hover without a delay
please help
here is my code -
#full{
top: 0px;
left: 0px;
width: 100%;
height: auto;
-webkit-transition: all 0.5s ease;
}
#full > #header{
top: 0px;
width: 100%;
height: 50px;
background: #e25959;
position: fixed;
-webkit-transition: all 0.5s ease;
}
#full > #header > .link{
position: relative;
float: right;
color: #fff;
margin: 15px;
-webkit-transition: all 0.5s ease;
}
#full > #header > .link:hover{
border-bottom: 1px solid #fff;
cursor: default;
}
and my html -
<div id="full">
<div id="header">
<div class="link">MY WORK</div>
<div class="link">ABOUT ME</div>
<div class="link">HOME</div>
</div>
</div>
Try initially setting the border-bottom to transparent:
#full > #header > .link{
position: relative;
float: right;
color: #fff;
margin: 15px;
-webkit-transition: all 0.5s ease;
border-bottom: 1px solid transparent; /* <------ */
}
Here's an example, http://jsfiddle.net/wf3fc/3/
Do this:
#full > #header > .link {
position: relative;
float: right;
color: #fff;
margin: 15px;
border-bottom: 1px solid rgba(0,0,0,0);
-webkit-transition: all 0.5s ease 0s;
}
#full > #header > .link:hover {
border-bottom-color: #fff;
cursor: default;
}