Welcome to the Treehouse Community
Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.
Looking to learn something new?
Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.
Start your free trial
Mikey Neilson
Front End Web Development Techdegree Student 12,642 PointsHelp with navbar
Hi treehouse community i'm trying to make a navbar but i seem to be going wrong with the links in it can anyone shed an light on this for me, I am a newbie to this so not sure if what iv done is on the right lines ,i'm sure that i will be told if its totally wrong :) here is my code
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Vaping Bean</title>
<link rel="stylesheet" href="normalize.css">
<link href='https://fonts.googleapis.com/css?family=Nosifer|Creepster|Kalam' rel='stylesheet' type='text/css'>
<link rel="stylesheet" href="main.css">
</head>
<body>
<div class="container">
<header class="navbar">
<ul>
<li><h1 class="name">Vaping Bean</h1></li>
<li><a href="#">Home</a></li>
<li><a href="#">Starter Kits</a></li>
<li><a href="#">Atomizers</a></li>
<li><a href="#">E-liquid</a></li>
<li><a href="#">Contact</a></li>
</ul>
</header>
</div>
</body>
</html>```
```css
body {
margin: 0;
font-size: 1.5em;
}
.name {
margin: 10px 20px;
padding: 0 20px 0 5px;
background-color: green;
font-size: 2em;
font-family: 'Nosifer', sans-serif;
text-shadow: 5px 10px 10px #fff;
border-radius: 5px;
}
.navbar ul {
list-style-type: none;
margin: 0;
padding: 0;
overflow: hidden;
background-color: #333;
}
.navbar li {
float: left;
border-right: 1px solid #fff;
}
.navbar li a {
display: block;
text-align: right;
color: white;
padding: 14px 16px;
text-decoration: none;
font-size: 1em;
} ```
2 Answers
woodworth
Front End Web Development Techdegree Student 19,831 PointsAre you trying to get the nav to display on one line across the top? If so, you need to add:
display: inline;
to your .navbar li section. More info here: http://www.w3schools.com/css/css_navbar.asp
If you want your nav links to work, you need to update your link's html code==> a href=" your link info goes in here ". More info here: http://www.w3schools.com/html/html_links.asp
Hope this helps.
Mikey Neilson
Front End Web Development Techdegree Student 12,642 PointsThanks woodworth will check them links out :)
Kristopher Van Sant
Courses Plus Student 18,830 PointsKristopher Van Sant
Courses Plus Student 18,830 PointsHey there. I moved your answer to the answer section so that it can be voted on and potentially marked as "Best Answer" :)