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
Jenny Swift
21,999 PointsH1 margin and font-size not working
Hi, I am trying to remove the top margin of my h1 as well as change its font size, but nothing happens when I give it a margin zero or other margin value, and nothing happens when I try to change its font size. It is responding fine to other properties I give it. Here is my code. Can anyone help me please?
<!DOCTYPE html>
<html>
<head>
<title>Title of the document</title>
<link rel="stylesheet" type="text/css" href="test.css">
<link rel="stylesheet" type="text/css" href="normalize.css">
</head>
<body>
<h1>Heading</h1>
</body>
</html>
h1 {
background-color: lightblue;
margin: 0 0;
text-align: center;
font-size: 2em;
}
3 Answers
Trevor Lawrence
2,249 Pointsare your style sheets in the right order? I think the normalize stylesheet is overriding your test style sheet. switch the order so normailze is first, than style and try it..
Jenny Swift
21,999 PointsThank you so much! That fixed both problems.
Steve Linn
11,841 PointsTry using 0px
Jenny Swift
21,999 PointsProblems solved now thanks to Trevor. Thank you Steve and Hayden for your attempts.
Hayden Taylor
5,076 PointsHayden Taylor
5,076 Pointsh1 { background-color: lightblue; margin-top: 0; text-align: center; font-size: 50px;
}
Does that change the font-size and remove the top margin?