search engine optimization articles do it yourself seo hiring search engine experts html and search engine optimization web site analysis and submission service

HTML Help: Get Rid of Page Margins

I want my header graphic to go from one edge of the screen to the other, but no matter what I try there is a margin of about a 1/4 inch on both sides of the screen. How do I get rid of this unwanted space?
Aw . . . the poor, unwanted space. It's sad to be unwanted, but...

There is a default margin of about 22 pixels around your web page. This can be removed, or expanded, with CSS. Place the following code in the HEAD section of your page:

<style type="text/css">
body {margin: 0px;}
</style>

If you use an external style sheet you can just place the center line of those three lines in it. That code will remove the margin from all four sides. If you want different sides to have different margins you can do that too:

<style type="text/css">
body {margin-top: 25px;
      margin-right: 0px;
      margin-bottom: 100px;
      margin-left: 0px;}
</style>
Just change the number of pixels for each side to what you need. The order should always be clockwise starting from the top, so it's top, right, bottom, and left whenever you specify individual borders.
This concludes the

HTML Help about Getting Rid of Page Margins

. Based on your interest in this HTML FAQ, you may also be interested in CSS Made Easy.
Back | HTML FAQ | HTML Tag Chart | HTML Index | Web Design Tutorials
search engine optimization course
If you want your web site to rank high in the search engines . . . what are you going to do to get it there? Check out my search engine optmization guide, SEO for YOU: Search Engine Optimization for Ordinary Everyday People!

Check out SEO for YOU now!

Almost a Newsletter

Subscribe today for exclusive website design tutorials and grab some free gifts to boot! Learn more, or subcribe below:
Email:

First Name:

Privacy Policy

Did you know...

The member's site has about 100 standards compliant HTML and CSS tutorials, 31 handy reference charts, reprintable content, web graphics, exclusive fonts, free software, free ebooks and more? All this for less than 9 cents a day! [ Details ]
See my fancy bottom! :)