|
CSS Home
CSS TutorialIntroductionCSS Advantages CSS Syntax Implementing CSS CSS Class CSS ID CSS Font CSS Text CSS Background Code CSS Border CSS Margin CSS Padding CSS Lists CSS Height & Width CSS Positioning CSS Float CSS Layers CSS Summary CSS CodesCSS AlignCSS bgcolor CSS Cellpadding CSS Cellspacing CSS Hyperlinks CSS Leading Inline Style Sheets Embedded Style Sheets External Style Sheets CSS Scrollbars CSS Table Width CSS Print Version CSS Table-layout CSS ExamplesCSS ExamplesCSS Table-layout Example CSS ReferenceCSS Mini TutorialCSS Properties CSS Color Codes CSS Template CSS Media Types Got a MySpace Page?Get "www.yourname.com" for your MySpace page. Learn how >>. |
CSS MarginThe following CSS margin codes demonstrate the various CSS properties you can use to apply styles to the border of any HTML element. Margins define the space around the element. CSS margins are specified in a similar way to borders - they can be set individually for each side, or all sides at once. Setting Margins on all Sides
This results in: This text has a margin of 20 pixels on all four sides. It is nested within a div with a border to make it easier to see the effect of the margin. Setting Margins for Each SideIf you don't want the margin settings to be applied to all four sides, or if you want each side to have different margins applied, you can use the following properties:
Example:
<p style="border:1px solid orange;margin-left:60px;">This text has a left margin of 60 pixels.</p>
This results in: This text has a left margin of 60 pixels. Enjoy this website?
Oh, and thank you for supporting Quackit! |
FREE Hosting!With every domain name you register with ZappyHost, you get FREE (ad supported) hosting.PLUS you get:
Featured Template:
(Build your websites in minutes!) |