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
Abe Layee
8,378 PointsI don't why I have this margin on top
I have tried everything but still I have this margin on between the h1 and the header. Please take a look at this image to see what I am talking about. Here Website
<div id="wrapper">
<header class="header">
<a href="#logo" class="logo">Logo</a>
<nav>
<ul>
<li><a href="index.html">Home</a></li>
<li><a href="#portfolio">Portfolio</a></li>
<li><a href="#About">About</a></li>
<li><a href="#contact">Contact</a></li>
</ul>
</nav>
</header>
<section class="heroImg">
<article>
<h1>Abraham Swaray</h1>
<p>Web Developer</p>
</article>
</section>
</div>
Css code
/* Default Settings */
* {
margin: 0;
list-style: none;
padding: 0;
box-sizing: border-box; }
body {
margin: 0;
padding: 0; }
/* Wrapper*/
#wrapper {
margin: 0; }
/*Navigation*/
.header {
background: #3498db;
width: 100%;
height: 60px;
border-bottom: 2px solid;
border-radius: 5px;
margin: 0; }
nav {
width: 100%;
color: #fff;
text-align: right;
line-height: 50px; }
nav a {
color: #fff;
text-decoration: none;
padding: 10px; }
nav a:hover {
color: #99cbed; }
nav li {
display: inline-block;
line-height: 50px; }
/* Logo*/
.logo {
float: left;
line-height: 40px;
margin-left: 45px;
color: #fff;
text-decoration: none; }
/* Hero Image*/
.heroImg {
background: url("../img/cloudy-mountain.jpg") no-repeat center;
height: 100vh;
background-size: 100%; }
.heroImg > h1 {
margin: 0;
padding: 0; }
Josh Miclette
Courses Plus Student 6,227 PointsBy adding the code and positioning the section image to 'center' 'top', it resolved the issue for me (Chrome and Firefox). How are your stylesheets ordered? Try commenting out your normalize.css and see if that works. If it does, then something is overwriting that code.
James Anwyl
Full Stack JavaScript Techdegree Graduate 49,960 Points7 Answers
Josh Miclette
Courses Plus Student 6,227 PointsHi Abraham, try this:
/* Hero Image*/
.heroImg {
background: url("../img/cloudy-mountain.jpg") no-repeat;
background-position: center top;
height: 100vh;
background-size: 100%;
}
I removed 'center' from your 'background' and added a background-position property with the values 'center' and 'top'. The last CSS video I watched, the teacher mentioned adding image positioning to it's own line since it's easier to read. Let me know if that worked.
KWAME ADJEI
4,627 Pointswithout access to your source files i'd just be guessing but try these steps.
Check your header's unordered lists margins.
Try inspecting your site using chrome dev tools to find the exact problem.
Kevin Korte
28,149 PointsI'm also not able to reproduce the problem why I just copy and paste your code into Codepen.io
James Anwyl
Full Stack JavaScript Techdegree Graduate 49,960 PointsHi Abraham,
Wasn't able to reproduce the problem on my own computer (in chrome or firefox). But are you using a reset like normalize.css or the Eric Meyer reset? Not using a reset can cause problems like this - where browser default styles are being applied.
Abe Layee
8,378 PointsI am using normalize.css
Abe Layee
8,378 PointsStill not working. I am trying to figure it out. I have the normalize.css
Abe Layee
8,378 PointsThank you Josh Miclette. I remove the normalize.css and it works perfectly fine.
Josh Miclette
Courses Plus Student 6,227 PointsGlad I was able to help, Abraham.
Abe Layee
8,378 PointsAbe Layee
8,378 PointsJosh Miclette still not working.