Resources

Remove margins in HTML.

Page Margin settings. Something that on the surface seems very simple, yet unless you know how to correct it, it can be a bit of a mystery.

I've seen it asked many times, so this quick tutorial will demonstrate how to remove those page margins.

So, simply place the following into your page. (HTML 4.0)

<body leftmargin="0px" topmargin="0px" marginwidth="0px" marginheight="0px">

This eliminates the borders on your page, within the body element, so if you insert a table or an image, it will wrap to the edge of the screen with no gap between.

This can also be set for other elements, such as tables or paragraphs, using the following code:

<table border="1" style="margin: 0px;">

<p style="margin: 0px;">Text</p>

Individual margins can also be manipulated, e.g.

<p style="margin-left: 0px; margin-top: 0px;">Text</p>

The second way to do this is to set margin: 0px;in your stylesheet or inline style declarations for the BODY selector

Example of setting 0px margins for the body element:
Before


After

So, now you have control of your page margins!

Go to: Home | Client-side tutorial links





Remember, if you get stuck or need to ask any questions, register with the forums and tell us about it!

TemplateMonster - Affordable & Professional website templates!

Warning: include(includes/ads.php) [function.include]: failed to open stream: No such file or directory in /home1/design/public_html/tutorials.php on line 125

Warning: include(includes/ads.php) [function.include]: failed to open stream: No such file or directory in /home1/design/public_html/tutorials.php on line 125

Warning: include() [function.include]: Failed opening 'includes/ads.php' for inclusion (include_path='.:/usr/lib/php:/usr/local/lib/php') in /home1/design/public_html/tutorials.php on line 125


le>