Reputation: 484
I have a fixed header, so that when I scroll it remains at the top of the page so that visitors may navigate quickly or skip sections of the page.
Here is a picture of my problem:
The problem is pretty simple - I want my header to float over the top of any other objects instead of being hidden by them, but I assume there isn't a way to do it without javascript. Here is my CSS:
#primary header {
position: fixed;
margin: 0;
padding: 0;
width: 100%;
height: 50px;
background-color: rgb(49,49,49);
}
nav { /* positions nav menu */
position: fixed; /* keeps the nav bar fixed at top when scrolling */
top: 1.25%;
left: 27%;
}
nav a {
margin: 0 50px;
padding: 10px 20px;
font-size: 20px;
}
Anyway I can do this? I am not familiar with Javascript, but would love some help!
Upvotes: 2
Views: 2775
Reputation: 742
The z-index property is a common solution to elements which are positioned, but it looks like YouTube has provided a solution as well.
Add a parameter to force YouTube iframe to set a low z-index.
If you have any element you’ll like to show above a YouTube iframe you just have to add a parameter to the iFrame URL.
<iframe width="560" height="315" src="//www.youtube.com/embed/0HxNtWEIKhQ?wmode=transparent" frameborder="0" allowfullscreen></iframe>
JSFiddle didn't seem to reproduce the issue, but here is an example as well:
StackOverflow Duplicate Question
YouTube API Documentation (Preferable Embedding Method)
Upvotes: 1
Reputation: 16841
Set the css z-index
property on your fixed element. The higher the value, most in front it will get...
Like:
#primary header {
z-index: 999; /* SET THE NEEDED AMOUNT */
}
Upvotes: 7