Wenn ich den Hover-Effekt umschalte, verbirgt der Hintergrund den Text. Welches Attribut sollte ich hinzufügen, dass der Text der Listenpunkte nicht unter dem ": before" Hintergrund liegt.CSS-Hover-Animation versteckt Text
Ich poste auch einen Code-Link, so dass es einfach ist, meinen Code zu überprüfen.
Dank
<nav>
<ul>
<li>#1111111111</li>
<li>#2222222222</li>
<li>#3333333333</li>
</ul>
</nav>
nav {
position: absolute;
top: 0;
bottom: 0;
background-color: #2c3e50;
width: 100px;
}
nav ul {
margin: 0;
padding: 0;
}
nav ul li {
border-bottom: 1px solid #ecf0f1;
padding: 10px 0 10px 0;
position: relative;
color: red;
}
nav ul li:hover {
color: green;
}
nav ul li:before {
position: absolute;
content: '';
top:0;
left: 0;
width: 0;
height: 100%;
background-color: white;
transition:all 0.3s ease;
z-index: 0;
}
nav ul li:hover::before {
width: 100%;
}
Codepen: http://codepen.io/anon/pen/oBXwVB
Das Problem ist die ': before' es versteckt ist. –
z-index: -1 bis: vor, oder anders html/css ... http: //codepen.io/anon/pen/BpNdyO – sinisake
@sinisake 'z-index: -1' wird nicht richtig funktionieren? –