homepage Welcome to WebmasterWorld Guest from
register, free tools, login, search, pro membership, help, library, announcements, recent posts, open posts,
Become a Pro Member
Home / Forums Index / Code, Content, and Presentation / CSS
Forum Library, Charter, Moderators: not2easy

CSS Forum

Page borders or margins

Msg#: 4364502 posted 8:52 pm on Sep 19, 2011 (gmt 0)

please bare with me because i have absolutely no knowledge of website coding. anyways, I have a site im building out of css but when i view the site, there are two white borders or margins on the sides. i dont know how to manipulate the code to change this. here are you pieces of code which i think are the areas of trouble:

.mainTable {
background: transparent;
border: none
.mainContent {
background: transparent;
margin:10px 0px 20px 0px;
.navbarBottom, .navbarTop {
.navigation {
background: url(http://www.example.com/soundclip.jpg;
margin:-5px 0px -25px 0px;
.navigation , .navigationDivider, .navigation .headline, .navigation .div, .navigation img {
.navigation .statsNumbers {
form .mailingList {
.mlheadline {display:none;}


body {
background-image: url(http://www.example.com/soundclip.jpg;
background-color: #ffffff;
background-position: top center;
background-repeat: no-repeat;
img {border: none; }
body, div, tr, td, select, textarea, input, option {

any help? can someone re-write this for me?

[edited by: alt131 at 5:18 am (utc) on Sep 20, 2011]
[edit reason] Thread Tidy [/edit]



WebmasterWorld Senior Member topr8 us a WebmasterWorld Top Contributor of All Time 10+ Year Member

Msg#: 4364502 posted 8:24 am on Sep 20, 2011 (gmt 0)

personally i always start my css file with

this sets the border and margin of everything to zero and after that i specifically set the borders/margins for any elements and so on


WebmasterWorld Senior Member lucy24 us a WebmasterWorld Top Contributor of All Time Top Contributors Of The Month

Msg#: 4364502 posted 7:50 pm on Sep 20, 2011 (gmt 0)

Possibly also {padding: 0;} ;)

At the very beginning of your post you say "borders or margins". They are different things, so let's make sure you know the difference. Memorize this picture:

A border is a visible attribute. You meet it most often in tables, in the form of a line around a cell. Or row, or the whole table. You can set the border's size, shape and color to anything you like, either for all four sides at once, or for each one separately. A simple way of testing css is to give your questioned element a ridiculous border like {dotted red} so you can make sure it's sitting exactly where you want it to be. And then you remove the border.

A margin is the space between two elements, such as the extra space between paragraphs in a plain-text html document. You can set its size, but not its color, because it uses the background color of whatever element is between the two things. (Technically its color is "transparent".) In general, margins overlap: if your paragraphs say {margin-top: 1em; margin-bottom: .5em;} the total space between paragraphs will be 1 em.

Padding is the space around an element, for example blank space around a table cell so it doesn't crash into its neighbor. Unlike a margin, padding is part of the element itself, so it uses the element's own background color or image and there is no overlap.

If an element has a border, it will be drawn outside the padding but inside the margin. The thickness of the border is measured separately; it isn't subtracted from either the padding or the margin.

In general, you want text to have side margins so it doesn't slam right up against the edge of the page. Unreadable. But the margin is only white if you haven't set a background for the html or body (in most but not all cases these two are the same).

Global Options:
 top home search open messages active posts  

Home / Forums Index / Code, Content, and Presentation / CSS
rss feed

All trademarks and copyrights held by respective owners. Member comments are owned by the poster.
Home ¦ Free Tools ¦ Terms of Service ¦ Privacy Policy ¦ Report Problem ¦ About ¦ Library ¦ Newsletter
WebmasterWorld is a Developer Shed Community owned by Jim Boykin.
© Webmaster World 1996-2014 all rights reserved