Menu
Forums
All threads
Latest threads
New posts
Trending threads
New posts
Search forums
Trending
What's new
New posts
New profile posts
Latest activity
Members
Current visitors
New profile posts
Search profile posts
Upgrades
Log in
Register
What's new
Search
Search
Search titles only
By:
All threads
Latest threads
New posts
Trending threads
New posts
Search forums
Menu
Log in
Register
Navigation
Install the app
Install
More options
Contact us
Close Menu
Forums
Software Development
Programming
Programming Q&A
CSS Help - Navbar Overlapping content
JavaScript is disabled. For a better experience, please enable JavaScript in your browser before proceeding.
You are using an out of date browser. It may not display this or other websites correctly.
You should upgrade or use an
alternative browser
.
Reply to thread
Message
<blockquote data-quote="RandomRyan" data-source="post: 463580" data-attributes="member: 39533"><p>Hi,</p><p></p><p>I need help with my Navbar. I'm trying to figure out why the Navbar is overlapping the content. When I click one of the links on the navbar, the content goes to the top of the page when clicked. But the navbar is covers it.</p><p></p><p>I tried to search for the answer on Google, but the only thing that comes up is Bootstrap solutions. </p><p></p><p>Thanks.</p><p></p><p>HTML:</p><p></p><p>[CODE=html]<body></p><p></p><p> <div class="topbar"></p><p> <img src="images/phone.png" alt="" class="phone"></p><p> <h2>222-222-2222</h2></p><p> </div></p><p></p><p> <div class="nav"></p><p> <input type="checkbox" id="check"></p><p> <label for="check" class="checkbtn"></p><p> <i class="fas fa-bars"></i></p><p> </label></p><p> <img src="images/logo.png" alt="" class="logo"></p><p> <ul></p><p> <li><a class="active" href="#">Home</a></li></p><p> <li><a class="scrollTo" href="#about">About</a></li></p><p> <li><a href="#services">Services</a></li></p><p> <li><a href="#instagramfeed">Gallery</a></li></p><p> <li><a href="#contact">Contact</a></li></p><p> </ul></p><p> </div></p><p></p><p> <section id="banner"></p><p> <div class="banner"></p><p></p><p> </div></p><p> </section></p><p></p><p> <!-- About/welcome page --></p><p> <section id="about"></p><p> <div class="aboutus"></p><p> <p id="about">Landscaping</p></p><p> <p>Another paragraph</p></p><p> </div></p><p> </section></p><p>[/CODE]</p><p></p><p>CSS:</p><p></p><p>[CODE=css]*{</p><p> margin: 0;</p><p> padding: 0;</p><p> box-sizing: border-box;</p><p> list-style: none;</p><p> text-decoration: none;</p><p>}</p><p></p><p>.topbar {</p><p> background: #e5e5e5;</p><p> height: 80px;</p><p> width: 100%;</p><p> display: flex;</p><p> position: fixed;</p><p> z-index: 2;</p><p>}</p><p></p><p>.topbar .phone {</p><p> margin-left: 74%;</p><p> margin-top: 8px;</p><p> margin-right: -14px;</p><p> float: left;</p><p> height: 25px;</p><p> width: 25px;</p><p>}</p><p></p><p>.topbar h2 {</p><p> font-family: Lato-Regular, sans-serif;</p><p> font-size:20px;</p><p> color: #444444;</p><p> line-height: 4px;</p><p> width: 100%;</p><p> height: auto;</p><p> padding: 1%;</p><p>}</p><p></p><p>@media (max-width: 1000px) {</p><p> .topbar .phone {</p><p> margin-left: 7px;</p><p> }</p><p></p><p> .topbar h2 {</p><p> margin-left: 10px;</p><p> margin-top: 14px;</p><p> }</p><p></p><p>}</p><p></p><p> .nav {</p><p> background: #fff;</p><p> height: 150px;</p><p> width: 100%;</p><p> margin-top: 40px;</p><p> position: fixed;</p><p> z-index: 2;</p><p> border-bottom: 10px solid #257834;</p><p>}</p><p></p><p>.nav img.logo{</p><p> width: 244px;</p><p> float: left;</p><p> margin-top: 2px;</p><p> margin-left: 60px;</p><p> margin-bottom: 6px;</p><p>}</p><p>.nav ul{</p><p> float: right;</p><p> margin-right: 110px;</p><p> margin-top: 30px;</p><p>}</p><p>.nav ul li{</p><p> display: inline-block;</p><p> line-height: 80px;</p><p> margin: 0 2px;</p><p>}</p><p>.nav ul li a{</p><p> color: black;</p><p> font-weight: 500;</p><p> font-size: 20px;</p><p> padding: 7px 13px;</p><p> border-radius: 3px;</p><p> font-family: OpenSansBold, sans-serif;</p><p>}</p><p>.nav a.active, .nav a:hover{</p><p> background: #f2f2f2;</p><p> transition: .5s;</p><p>}</p><p>.nav .checkbtn {</p><p> font-size: 30px;</p><p> color: black;</p><p> float: right;</p><p> line-height: 80px;</p><p> margin-right: 40px;</p><p> margin-top: 50px;</p><p> cursor: pointer;</p><p> display: none;</p><p>}</p><p>.nav #check {</p><p> display: none;</p><p>}</p><p></p><p>@media (max-width: 952px){</p><p> .nav label .logo{</p><p> font-size: 27px;</p><p> padding-left: 25px;</p><p> }</p><p> .nav ul li a{</p><p> font-size: 16px;</p><p> }</p><p>}</p><p>@media (max-width: 858px){</p><p> .nav .checkbtn{</p><p> display: block;</p><p> margin-right: 40px;</p><p> }</p><p> .nav ul{</p><p> position: fixed;</p><p> width: 100%;</p><p> height: 100vh;</p><p> background: #d6d6d6;</p><p> top: 160px;</p><p> left: -100%;</p><p> text-align: center;</p><p> transition: all .5s;</p><p> }</p><p> .nav ul li{</p><p> display: block;</p><p> margin: 50px 0;</p><p> line-height: 30px;</p><p> }</p><p> .nav ul li a{</p><p> font-size: 20px;</p><p> }</p><p> a:hover,a.active{</p><p> background: none;</p><p> color: white;</p><p> }</p><p> #check:checked ~ ul{</p><p> left: 0;</p><p> }</p><p>}</p><p></p><p></p><p>/* banner */</p><p></p><p> #banner .banner {</p><p> width: 100%;</p><p> height: 900px;</p><p> background-image: url(images/kelowna.jpg);</p><p> background-size: cover;</p><p> background-position: center top;</p><p> background-repeat: no-repeat;</p><p> }</p><p></p><p> /* About */</p><p> #about .aboutus {</p><p> width: 100%;</p><p> height: fixed;</p><p> margin-bottom: 60px;</p><p> background: #FEFEFE;</p><p> }</p><p></p><p> .aboutus p {</p><p> font-family: OpenSansLight;</p><p> text-align: center;</p><p> font-size: 16px;</p><p> margin-top: 40px;</p><p> margin-bottom: -5px;</p><p> }[/CODE]</p></blockquote><p></p>
[QUOTE="RandomRyan, post: 463580, member: 39533"] Hi, I need help with my Navbar. I'm trying to figure out why the Navbar is overlapping the content. When I click one of the links on the navbar, the content goes to the top of the page when clicked. But the navbar is covers it. I tried to search for the answer on Google, but the only thing that comes up is Bootstrap solutions. Thanks. HTML: [CODE=html]<body> <div class="topbar"> <img src="images/phone.png" alt="" class="phone"> <h2>222-222-2222</h2> </div> <div class="nav"> <input type="checkbox" id="check"> <label for="check" class="checkbtn"> <i class="fas fa-bars"></i> </label> <img src="images/logo.png" alt="" class="logo"> <ul> <li><a class="active" href="#">Home</a></li> <li><a class="scrollTo" href="#about">About</a></li> <li><a href="#services">Services</a></li> <li><a href="#instagramfeed">Gallery</a></li> <li><a href="#contact">Contact</a></li> </ul> </div> <section id="banner"> <div class="banner"> </div> </section> <!-- About/welcome page --> <section id="about"> <div class="aboutus"> <p id="about">Landscaping</p> <p>Another paragraph</p> </div> </section> [/CODE] CSS: [CODE=css]*{ margin: 0; padding: 0; box-sizing: border-box; list-style: none; text-decoration: none; } .topbar { background: #e5e5e5; height: 80px; width: 100%; display: flex; position: fixed; z-index: 2; } .topbar .phone { margin-left: 74%; margin-top: 8px; margin-right: -14px; float: left; height: 25px; width: 25px; } .topbar h2 { font-family: Lato-Regular, sans-serif; font-size:20px; color: #444444; line-height: 4px; width: 100%; height: auto; padding: 1%; } @media (max-width: 1000px) { .topbar .phone { margin-left: 7px; } .topbar h2 { margin-left: 10px; margin-top: 14px; } } .nav { background: #fff; height: 150px; width: 100%; margin-top: 40px; position: fixed; z-index: 2; border-bottom: 10px solid #257834; } .nav img.logo{ width: 244px; float: left; margin-top: 2px; margin-left: 60px; margin-bottom: 6px; } .nav ul{ float: right; margin-right: 110px; margin-top: 30px; } .nav ul li{ display: inline-block; line-height: 80px; margin: 0 2px; } .nav ul li a{ color: black; font-weight: 500; font-size: 20px; padding: 7px 13px; border-radius: 3px; font-family: OpenSansBold, sans-serif; } .nav a.active, .nav a:hover{ background: #f2f2f2; transition: .5s; } .nav .checkbtn { font-size: 30px; color: black; float: right; line-height: 80px; margin-right: 40px; margin-top: 50px; cursor: pointer; display: none; } .nav #check { display: none; } @media (max-width: 952px){ .nav label .logo{ font-size: 27px; padding-left: 25px; } .nav ul li a{ font-size: 16px; } } @media (max-width: 858px){ .nav .checkbtn{ display: block; margin-right: 40px; } .nav ul{ position: fixed; width: 100%; height: 100vh; background: #d6d6d6; top: 160px; left: -100%; text-align: center; transition: all .5s; } .nav ul li{ display: block; margin: 50px 0; line-height: 30px; } .nav ul li a{ font-size: 20px; } a:hover,a.active{ background: none; color: white; } #check:checked ~ ul{ left: 0; } } /* banner */ #banner .banner { width: 100%; height: 900px; background-image: url(images/kelowna.jpg); background-size: cover; background-position: center top; background-repeat: no-repeat; } /* About */ #about .aboutus { width: 100%; height: fixed; margin-bottom: 60px; background: #FEFEFE; } .aboutus p { font-family: OpenSansLight; text-align: center; font-size: 16px; margin-top: 40px; margin-bottom: -5px; }[/CODE] [/QUOTE]
Insert quotes…
Verification
Post reply
Forums
Software Development
Programming
Programming Q&A
CSS Help - Navbar Overlapping content
Top