Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Form Margins

Status
Not open for further replies.

milams

Programmer
May 28, 2004
32
US
I'm kind of new to CSS. Is there a way to get rid of the margins that are in forms?
 
<form style="margin:0;" ...>

Tracy Dryden

Meddle not in the affairs of dragons,
For you are crunchy, and good with mustard. [dragon]
 
Rather than sitting the style inline (which is perfectly valid)... I tend to do some of these "resetting" tasks in the CSS block of the page (or in linked CSS files).

In the <head> section of your page:
Code:
<style type="text/css">
form, fieldset { margin:0; padding:0; }
</style>
There are several other elements than can benefit from this (because browsers provide different margins and paddings by default)... with the idea being you specifically set the padding and margin as you need it (rather than relying on browser defaults - which vary from OS to OS and browser to browser).

This includes "resetting" these ones:
Code:
<style type="text/css">
form, fieldset[b], body, h1, h2, h3, p[/b] { margin:0; padding:0; }
</style>
I'm sure you'll develop your own style [smile]

Cheers,
Jeff

[tt]Jeff's Page @ Code Couch
[/tt]

What is Javascript? FAQ216-6094
 
You're right Jeff. I just dashed off the easy answer. Lazy of me.

Tracy Dryden

Meddle not in the affairs of dragons,
For you are crunchy, and good with mustard. [dragon]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top