Ralphunreal Ralphunreal - 4 months ago 7
CSS Question

links do not have a hover effect

I noticed my a tags have no hover for some reason. I am thinking it has to do with my background video that I am using but not sure. Here is the jsfiddle and notice the red links have no hover.

jsfiddle - https://jsfiddle.net/r9aen1w3/

<div id="navigation">
<ul>
<li><a href="#">home</a></li>
<li><a href="#">home</a></li>
<li><a href="#">home</a></li>
</ul>
</div>

<div class="background-wrap">


<video id="video-bg-elem" preload="auto" autoplay="true" loop="loop" muted="muted">
<source src="north.mp4" type="video/mp4">
Video not supported
</video>


</div>


<div class="content">
<h1>Video Background Tutorial</h1>
<p>This tutorial shows you how to put video as a background for your website.</p>
</div>







*{
margin:0;
padding:0;
}

body{
font-family:calibri,sans-serif;
}

.background-wrap{
position:fixed;
z-index:-1000;
width:100%;
height:100%;
overflow:hidden;
top:0;
left:0;
}

#video-bg-elem{
position:absolute;
top:0;
left:0;
min-height:100%;
min-width:100%;
}

.content{
position:absolute;
width:100%;
min-height:100%;
z-index:1000;

}

.content h1{
text-align:center;
font-size:65px;
text-transform:uppercase;
font-weight:300;
color:#fff;
padding-top:15%;
margin-bottom:10px;
}

.content p{
text-align:center;
font-size:20px;
letter-spacing:3px;
color:#aaa;
}

#navigation{
float:right;
margin-right:100px;
margin-top:30px;
width:400px;
}

#navigation ul li{
float:left;
margin-right:30px;
}

#navigation ul li a{
color:white;
}

Answer

It is because of z-index.

Either this 2 approach would fix that.

1.Just make your class .content to z-index:-1 .

.content {
  z-index: -1;
}

2.Just make your class .content to z-index:1 and add position:relative with z-index:2to id #navigation .

.content {
  z-index: 1;
}
#navigation {
  position:relative;
  z-index: 2;
}

Learn more about z-index, check it HERE.

Comments