Added: 19 February, 2008
Group: CSS
Resetting default padding and margins with CSS
Author: Alex
page: 1

Resetting default padding and margins with CSS

Common problem in designing web pages with CSS is correct positioning of elements and aligning everything to fit well in all modern web browsers.


n this tutorial I will try to explain my methods in solving those issues.

Fist, it is essential to set all margins and padding on 0px because Firefox, Opera and Internet Explorer doesn't have same values for default positions. Therefore I set everything with:

html,body,li,ul,img,form,h1,h2,h3,h4,h5,h6,hr{
margin:0px;
padding:0px;
}


This little rule removes all the padding and margins from every element in your page and even that it can be drastic move for someone it is useful for two reasons: easier debugging and cross browser compatibility.

Second useful hack that should be used for formatting web pages with css and aligning content boxes without using table HTML element. Instead of

<table width="700" align="center">


This simple css style will do the same and create content box, 700 px wide, aligned at the center of the page that can be used as base element for setting other webpage elements.

.content{
position:relative;
width:700px;
background: #ccc;
margin-left: auto;
margin-right: auto;
}


GO to: Page 1 : Resetting default padding and margins with CSS


TechTut.com This tutorial is copyrighted. Partial duplication or full duplication is prohibited and illegal. Translation or usage of any kind without author�s permission is illegal.
  • Create a realistic chrome car rims
  • Create a realistic looking satellite dish
  • How to create a coin using maya
  • How to create airplane model
  • Create a soccer ball in 3D studio max
  • Create Seductive Vampire's in Photoshop
  • Rugby ball - American football ball 3d model
  • Create apple bowl in 3D max
Join our RSS feed
Use our RSS feed to get the latest published tutorials directly to your news reader.
Add to Google
Best tutorials for maya 3d max photoshop and more