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

HTML Introduction to HTML and CSS (2016) Adding a New Web Page Write the CSS

yakov sachuk
yakov sachuk
4,768 Points

How I can cancel the default browser's "Margin"?

For example: I've tag "<h1>" that has a background color, but its field has space between its border to the edge of the browser's window.

illustration:

html code. <h1>Yakov Sachuk,Web developer</h1>

css code:

h1 { background-color: grey; padding:7px; margin-left:0px; }

3 Answers

Steven Parker
Steven Parker
231,275 Points

You're probably seeing the default body margin. Try turning that off also:

body { margin: 0; }
yakov sachuk
yakov sachuk
4,768 Points

Thank you,it was worked!

Antonio De Rose
Antonio De Rose
20,885 Points

for that purpose, developers use, a file like a reset.css, you can get that in this link https://meyerweb.com/eric/tools/css/reset/, copy it, create the file reset.css, moreover, make sure, you call this file before the style.css file

Steven Parker
Steven Parker
231,275 Points

That seems rather drastic, and some of the changes it makes might not be desirable. For example, you might not want to lose the ability to tell a paragraph from a new line.

yakov sachuk
yakov sachuk
4,768 Points

Nice , through this file my codding be much easier. Thank you.

yakov sachuk
yakov sachuk
4,768 Points

Steven Parker "That seems rather drastic, and some of the changes it makes might not be desirable." thanks for your note ,I'll take attention for this.