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 trialLilly Doherty
2,458 PointsNav is higher on the page than logo
Hello, I think I may have just looked over something, but I can't figure out a solution. My nav is set higher on the page than #logo and I'm not sure how it happened. I think it's something I did while working on the media query for min-width: 660px; but I can't spot any errors.
@media screen and (min-width: 480px) {
/**********************
TWO COLUMN LAYOUT
***********************/
#primary {
width: 50%;
float: left;
}
#secondary {
width: 40%;
float: right;
}
/**********************
PAGE: PORTFOLIO
***********************/
#gallery li {
width: 28.3333%;
}
#gallery li:nth-child(4n) {
clear: left;
}
/* above with the nth-child is stating that any styling that's here be applied to every 4th element in gallery list */
/**********************
PAGE: PORTFOLIO
***********************/
.profile-photo {
float: left;
margin: 0 5% 80px 0;
}
}
@media screen and (min-width: 660px) {
/**********************
HEADER
***********************/
nav {
background:none;
float: right;
font-size: 1.125em;
margin-right: 5%;
text-align: right;
width: 45%;
}
#logo {
float: left;
margin-left: 5%;
text-align: left;
width: 45%;
}
h1{
font-size:2.5em;
}
h2{
font-size:0.825em;
margin-bottom: 20px;
}
header {
border-bottom: 5px solid #558ba0;
margin-bottom: 60px;
}
}
I've found I can adjust how far down the nav is by adjusting it's margin in main.css but it effects the mobile view. I'm posting the nav code from main.css in case I messed something up there.
/**********************
NAVIGATION
***********************/
nav{
text-align: center;
padding: 10px 0;
margin: 20px 0 0;
}
nav ul {
list-style: none;
/* list-style just in case */
margin: 0 10px;
padding: 0;
}
nav li {
display: inline-block;
}
nav a {
font-weight: 800;
padding: 15px 10px;
}
Lilly Doherty
2,458 Points<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>Lilly Doherty | Portfolio</title>
<link rel="stylesheet" href="css/normalize.css">
<!--FONTS FROM GOOGLE ARE LINKED HERE. JUST BELOW-->
<link href="https://fonts.googleapis.com/css?family=Arvo:400,400i,700,700i|Kadwa:400,700" rel="stylesheet">
<link rel="stylesheet" href="css/main.css">
<link rel="stylesheet" href="css/responsive.css">
</head>
<body>
<header>
<a href="index.html" id="logo">
<h1>Lilly Doherty</h1>
<h2>Freelancer</h2>
</a>
<nav>
<ul>
<li><a href="index.html">Portfolio</a></li>
<li><a href="about.html">About</a></li>
<li><a href="contact.html" class="selected">Contact</a></li>
</ul>
</nav>
</header>
<div id="wrapper">
<section id="primary">
<h3>General Information</h3>
<p>I am currently open for new work. If you have any questions, please don't hesitate to contact me, edit this section later to personalize it for myself.</p>
<p>Please only use the phone contact for urgent inquiries. Otherwise, email is the best way to reach me.</p>
</section>
<section id="secondary">
<h3>Contact Details</h3>
<ul class="contact-info">
<li class="phone"><a href="tel:555-5555">555-5555</a></li>
<li class="mail"><a href="mailto:lilly3doherty@gmail.com">lilly3doherty@gmail.com</a></li>
<li class="twitter"><a href="http://twitter.com/intent/tweet?screen_name=puckarooni">@puckarooni</a></li>
</ul>
</section>
<footer>
<a href="http://twitter.com/puckarooni"><img src="img/twitter-wrap.png" alt="Twitter Logo" class="social-icon"></a>
<a href="http://facebook.com"><img src="img/facebook-wrap.png" alt="Facebook Logo" class="social-icon"></a>
<p>© 2017 Lilly Doherty.</p>
</footer>
</div>
</body>
</html>
5 Answers
Dovie Kazinec
1,635 PointsFound a solution. In your responsive.css do this:
@media screen and (min-width: 660px) {
/**********************
HEADER
***********************/
nav {
background:none;
float: right;
font-size: 1.125em;
margin-right: 5%;
text-align: right;
width: 45%;
padding-top: 40px;
}
Lilly Doherty
2,458 PointsThat did it! Thank you so much for the help!!
Lilly Doherty
2,458 PointsUpdate: I've also found that I had some spacing between values and units in main.css, and getting rid of the spaces also corrected the issue.
started with:
h1 {
font-family: 'Kadwa', serif;
margin: 15 px 0 ;
font-size: 1.75em;
/* em is a <relative> unit of measurement. 1 em = current font size. adjustments are relavent to current font size */
font-weight: normal;
line-height: 0.8em;
after changing the space between value and unit in the margin:
h1 {
font-family: 'Kadwa', serif;
margin: 15px 0 ;
font-size: 1.75em;
/* em is a <relative> unit of measurement. 1 em = current font size. adjustments are relavent to current font size */
font-weight: normal;
line-height: 0.8em;
Kyle Southerland
UX Design Techdegree Student 11,117 PointsLilly,
The CSS I have matches yours exactly. I would suggest taking a look at the HTML or possibly posting it here.
Lilly Doherty
2,458 PointsI hadn't thought to look there, though I'm not quite sure what I'm looking for. Everything in the nav looks right. I've posted the HTML in a comment above for people to reference.
Dovie Kazinec
1,635 PointsLooked over your code. Everything looks alright. Can you show me your html?
Lilly Doherty
2,458 PointsSure thing, I've posted the html from the contact page above.
Dovie Kazinec
1,635 PointsYou forgot something, right under your responsive.css tag do this:
<meta name="viewport" content="width=device-width, initial-scale=1.0">
Tell me if this worked. If you could, send me a link to your workspace.
Lilly Doherty
2,458 PointsI've added the line, but it didn't work. Here's a link to the workspace: https://w.trhou.se/1o0yooheqt
Lilly Doherty
2,458 PointsLilly Doherty
2,458 PointsHere's a screenshot of what the nav is doing:
https://drive.google.com/file/d/0BxLuyGFwo5a7Z2R2anM2RVY2T1E/view?usp=sharing