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

CSS

H1 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;

}

h1 { background-color: lightblue; margin-top: 0; text-align: center; font-size: 50px;

}

Does that change the font-size and remove the top margin?

3 Answers

are 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..

Thank you so much! That fixed both problems.

Try using 0px

Problems solved now thanks to Trevor. Thank you Steve and Hayden for your attempts.