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
Manuel Esthaem
3,843 PointsLogo switches position on different files
Hello Community!
I've just completed the "How to make a website" course and have been loving it so far. In order to really take in what I just learned I decided to revise the content and start building a very simple portfolio page for my photography.
I now have the problem that the logo position is not consistent across two files, it jumps to a lower position on series.html
Here are my codes:
index.html
<!DOCTYPE html>
<html>
<head>
<title>Esthaem</title>
<meta charset="utf-8">
<link rel="stylesheet" href="css/normalize.css">
<link href='https://fonts.googleapis.com/css?family=Libre+Baskerville:400,400italic' rel='stylesheet' type='text/css'>
<link rel="stylesheet" href="css/main.css">
</head>
<body>
<header>
<a href="index.html" id="logo">
<h1>Esthaem</h1>
</a>
<nav>
<ul>
<li>
<a href="series.html">Series</a>
</li>
<li>
<a href="overview.html">Overview</a>
</li>
<li>
<a href="about.html">About/CV</a>
</li>
<li>
<a href="contact.html">Contact</a>
</li>
</ul>
</nav>
</header>
<div id="wrapper">
<section>
<img src="img/series/somos/Somos_3.jpg" id="img-start">
</section>
<footer>
<a href="http://instagram.com/esthaem" target="_blank">
<img src="img/social/instagram.jpg" alt="Instagram" class="social-icon">
</a>
<a href="http://facebook.com/esthaem" target="_blank">
<img src="img/social/facebook.jpg" alt="Facebook" class="social-icon">
</a>
<p>© 2016 Esthaem.</p>
</footer>
</div>
</body>
</html>
series.html
<!DOCTYPE html>
<html>
<head>
<title>Esthaem</title>
<meta charset="utf-8">
<link rel="stylesheet" href="css/normalize.css">
<link href='https://fonts.googleapis.com/css?family=Libre+Baskerville:400,400italic' rel='stylesheet' type='text/css'>
<link rel="stylesheet" href="css/main.css">
</head>
<body>
<header>
<a href="index.html" id="logo">
<h1>Esthaem</h1>
</a>
<nav>
<ul>
<li>
<a href="series.html">Series</a>
</li>
<li>
<a href="overview.html">Overview</a>
</li>
<li>
<a href="about.html">About/CV</a>
</li>
<li>
<a href="contact.html">Contact</a>
</li>
</ul>
</nav>
</header>
<div id="wrapper">
<section>
<ul id="gallery">
<li>
<a href="series/somos.html">
<img src="img/series/somos/Somos_3.jpg" alt="Somos, 2015">
<p>Somos, 2015</p>
</a>
</li>
<li>
<a href="series/aformofmadness/aformofmadness.html" alt="A form of Madness, 2016">
<img src="img/series/aformofmadness/11.jpg">
<p>A form of Madness, 2016</p>
</a>
</li>
</ul>
</section>
<footer>
<a href="http://instagram.com/esthaem" target="_blank">
<img src="img/social/instagram.jpg" alt="Instagram" class="social-icon">
</a>
<a href="http://facebook.com/esthaem" target="_blank">
<img src="img/social/facebook.jpg" alt="Facebook" class="social-icon">
</a>
<p>© 2016 Esthaem.</p>
</footer>
</div>
</body>
</html>
And here is the main.css
/*******************************
GENERAL
*******************************/
body {
font-family: 'Libre Baskerville', serif;
}
#wrapper {
max-width: 940px;
margin: 0 auto;
padding: 0 10px;
}
a {
text-decoration: none;
}
img {
max-width: 100%;
}
.selected {
text-decoration: underline;
}
/*******************************
HEADER
*******************************/
header {
float: left;
margin: 0 0 30px 0;
padding: 5px 0 0 0;
width: 100%;
}
#logo {
text-align: center;
margin: 0;
padding: 0;
}
h1 {
line-height: 0.8em;
font-size: 1.65em;
}
h2 {
font-size: 0.75em;
text-align: center;
font-weight: normal;
}
/*******************************
NAVIGATION
*******************************/
nav {
text-align: center;
padding: 10px;
}
nav ul {
list-style: none;
}
nav li {
display: inline-block;
margin: 0 10px;
font-size: 0.85em;
}
/*******************************
FOOTER
*******************************/
footer {
font-size: 0.75em;
text-align: center;
clear: both;
padding: 50px 0 0 0;
}
/*******************************
PAGE: START
*******************************/
#img-start {
max-width: 95%;
margin: 2.5%;
text-align: center;
margin-bottom: 10%;
}
/*******************************
PAGE: SERIES
*******************************/
#gallery {
list-style: none;
margin: 0;
padding: 0;
}
#gallery li {
max-width: 95%;
margin: 2.5%;
text-align: center;
}
#gallery li a p {
margin-bottom: 10%;
font-size: 0.75em;
}
I know that this is most probably a very dumb mistake considering my little knowledge so far, but after trying to get this right for an hour I would really appreciate any input :)
1 Answer
Ben Schroeder
22,818 PointsThe culprit is the float property on your header. You probably don't need it since you're also assigning it a width of 100%.
Manuel Esthaem
3,843 PointsManuel Esthaem
3,843 PointsThank you so much for the quick answer, this perfectly solved my problem! Could you maybe explain why exactly it didn't work that way? I'm trying to understand everything as much as possible.