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!
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

Basilio Gonzalez
11,583 PointsNav a elements off to the right
Hello, so I'm not really sure why I'm having this white space to the left of my links. It looks like they're getting pushed to the right, but I'm not really sure why. Any help would be greatly appreciated
<!doctype html>
<html>
<head>
<meta charset="UTF-8">
<title>Untitled Document</title>
<link rel="stylesheet" type="text/css" href="normalize.css">
<link href="//netdna.bootstrapcdn.com/font-awesome/4.0.3/css/font-awesome.css" rel="stylesheet">
<style>
body {
margin-left: 0;
margin-top: 0;
margin-right: 0;
box-sizing:border-box;
}
header {
background: black;
box-shadow:0 5px 5px hsla(0,0%,0%,0.45);
}
h1 {
color: white;
padding-left: 10px;
margin-top: 0px;
padding-top: 2px;
padding-bottom:2px;
margin-bottom: 2px;
}
li {
width: 20%;
float:left;
list-style: none;
background: red;
}
li a {
display: block;
background: black;
font-size:1.35em;
text-decoration: none;
}
#menu {
width:1.4em;
color: #fff;
clear:both;
font-size:1.35em;
text-align: center;
position: absolute;
top: 1px;
right: 20px;
z-index: 1;
}
#nav a {
text-decoration:none;
color: #fff;
}
nav {
clear:both;
}
@media screen and (max-width: 768px) {
#nav.js {
display: none;
width: 100%;
}
ul {
list-style:none;
}
li {
width:100%;
border-right:none;
}
}
@media screen and (min-width: 768px) {
#menu {
display: none;
}
}
/*****************************
Footer
*****************************/
footer {
clear:both;
position: absolute;
text-align: center;
background:black;
width: 100%;
color: #fff;
bottom: 0;
}
footer h4 {
margin-top: .75em;
margin-bottom: .75em;
}
section {
clear: both;
}
</style>
</head>
<body>
<header>
<h1> Basilio Gonzalez III </h1>
<ul id="nav">
<li><a href="#">About</a></li>
<li><a href="#">Contact</a></li>
<li><a href="#">Portfolio</a></li>
</ul>
</div>
</header>
<footer>
<h4>© 2014</h4>
</footer>
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.8.2/jquery.min.js"></script>
<script type="text/javascript">
$("#nav").addClass("js").before('<div id="menu">?</div>');
$("#menu").click(function(){
$("#nav").toggle();
});
$(window).resize(function(){
if(window.innerWidth >= 768) {
$("#nav").removeAttr("style");
}
});
</script>
</body>
</html>
1 Answer

Basilio Gonzalez
11,583 PointsNever mind figured it out, had to add a padding of 0 to #nav.js.