I was wondering how to make a HTML navbar using CSS. I've already got most of the code done but I'm caught up on one part. I need the header to turn solid once it's past a div on the page. Is there some sort of CSS class to do this, or will I have to set up a JavaScript script to change the CSS as time goes on. You can see my code on this site: here. I'm sorry, I'm a noob to CSS, but I'm trying my best to learn.
EDITED PAST HERE:
In the "cover.css" script on the site I use the class "masthead" to define the portion of the site that I use as the NavBar.
.masthead {
background-color: #000;
background-color: rgba(0,0,0,0.5);
position: fixed;
top: 0;
border-style: solid;
border-color: rgba(0,0,0,0.5);
border-radius: 5px;
}
After the user scrolls past a particular div on the page, I want to change the background-color:
to solid black (#000
). Hopefully this clarifies the question a bit.
` or an `
– Mike Apr 09 '14 at 18:18`?