html - Css hover triggering on a completely random element -
i making nested html menu. , reason, hover keeps triggering way before hover on correct element. it's if div or element triggering before hand.
i think has html structure , way calling hover in css.
see snippets below -
/*car assistant styles*/ .car-assist-container { position: relative; float: left; width: 210px; } .assist-label { display: block; font-size: 1em; float: left; padding: 7px; text-transform: uppercase; color: black; } .assist-label:hover > .assist-list { opacity: 1; height: auto; } .assist-list { width: 100px; background-color: #141825; height: 0; opacity: 0; -moz-transition: 0.4s ease; -webkit-transition: 0.4s ease; -o-transition: 0.4s ease; transition: 0.4s ease; display: block; } .assist-item{ color: white; display: block; width: 100%; padding: 8px; border-bottom: 1px solid #1d2435; font-family: 'montserrat', sans-serif; font-weight: 100; cursor: pointer; -webkit-transition: color 0.4s ease; -moz-transition: color 0.4s ease; -o-transition: color 0.4s ease; transition: ocolor 0.4s ease; } .assist-item:hover { color: #d40000; } .browse:after { content: '▸'; } .browse:hover > .browse-list{ opacity: 1; } .browse-list{ position: absolute; right: 0; width: 100px; background-color: #1d2435; top: 0; opacity: 0; -webkit-transition: opacity 0.4s ease; -moz-transition: opacity 0.4s ease; -o-transition: opacity 0.4s ease; transition: opacity 0.4s ease; z-index: -1; } .browse-item{ color: white; display: block; width: 100%; padding: 8px; border-bottom: 1px solid #141825; font-family: 'montserrat', sans-serif; font-weight: 100; } .browse-item:hover { color: #d40000; }
<div class="car-assist-container"> <a href="#" class="assist-label" id="label">car assistant <ul class="assist-list"> <li class="assist-item" id="carworth">car worth</li> <li class="assist-item browse"> browse <ul class="browse-list"> <li class="browse-item" id="browsemake">makes</li> <li class="browse-item" id="browsetype">types</li> <li class="browse-item" id="browseyear">year</li> </ul> </li> <li class="assist-item">compare</li> </ul> </a> </div>
this desired behaviour, minimal code change.
/*car assistant styles*/ .car-assist-container { position: relative; float: left; width: 210px; } .assist-label { display: block; font-size: 1em; float: left; padding: 7px; text-transform: uppercase; color: black; } .assist-label:hover > .assist-list { opacity: 1; height: auto; } .assist-list { width: 100px; background-color: #141825; height: 0; opacity: 0; -moz-transition: 0.4s ease; -webkit-transition: 0.4s ease; -o-transition: 0.4s ease; transition: 0.4s ease; display: block; overflow: hidden; margin: 0; } .assist-item{ color: white; display: block; width: 100%; padding: 8px; border-bottom: 1px solid #1d2435; font-family: 'montserrat', sans-serif; font-weight: 100; cursor: pointer; -webkit-transition: color 0.4s ease; -moz-transition: color 0.4s ease; -o-transition: color 0.4s ease; transition: ocolor 0.4s ease; } .assist-item:hover { color: #d40000; } .browse:after { content: '▸'; } .browse:hover > .browse-list{ opacity: 1; height: auto; } .browse-list{ position: absolute; right: 0; width: 100px; background-color: #1d2435; top: 0; opacity: 0; -webkit-transition: opacity 0.4s ease; -moz-transition: opacity 0.4s ease; -o-transition: opacity 0.4s ease; transition: opacity 0.4s ease; z-index: 1; height: 0; overflow: hidden; } .browse-item{ color: white; display: block; width: 100%; padding: 8px; border-bottom: 1px solid #141825; font-family: 'montserrat', sans-serif; font-weight: 100; } .browse-item:hover { color: #d40000; }
<div class="car-assist-container"> <a href="#" class="assist-label" id="label">car assistant <ul class="assist-list"> <li class="assist-item" id="carworth">car worth</li> <li class="assist-item browse"> browse <ul class="browse-list"> <li class="browse-item" id="browsemake">makes</li> <li class="browse-item" id="browsetype">types</li> <li class="browse-item" id="browseyear">year</li> </ul> </li> <li class="assist-item">compare</li> </ul> </a> </div>
Comments
Post a Comment