Tricky Tricks ›› Programming Tricks ›› CSS Tricks ›› Remove Page Margins With Css

Remove Page Margins With Css

CSS Tricks

Remove page margins with CSS:

Margins used to be removed from pages by using Netscapes and Internet Explorers proprietary attributes to the body tag; marginwidth, leftmargin, marginheight and topmargin. I think I've seen this set of attributes called the 4 Knights of Browser incompatability.

Nowadays, browser support for CSS is improved, so we can let CSS handle this the web standards way. Works in most standard compliant browsers.

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

Partners