SitePoint Sponsor

User Tag List

Results 1 to 2 of 2
  1. #1
    SitePoint Member
    Join Date
    Sep 2011
    Posts
    1
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Unhappy White border right side of page

    Hey guys
    ive always thought that
    margin: 0px;
    padding: 0px;
    will remove the default white border around a website
    however it is only partly working for me
    it works find if i use a background color
    however if i try and use a background image there is still a white border
    on the right side only

    any ideas?
    its probably a dumb mistake so let me know please
    thanks

  2. #2
    Community Advisor silver trophybronze trophy
    dresden_phoenix's Avatar
    Join Date
    Jun 2008
    Location
    Madison, WI
    Posts
    2,791
    Mentioned
    34 Post(s)
    Tagged
    2 Thread(s)
    Welcome to SitePoint, Mike.

    Am afraid you are misconstruing what constitute a border.

    Imagine an HTML element, lets say a div, to be a box. margin is a transparent space placed outside said box ( it has subtle nuances as how it interacts with the margins of other elements, but lets keep this explanation simple). Consequently bg images will NOT extend into the margin.

    Padding is space added INSIDE the element ( which is why its calculated as element size+ element padding).. as such it will show the bg images set in that element.

    Border actually acts just like padding ( really, it does), the only difference is that you can set a color to it, and thus cover up the the background image. if you wanted to show the image, you could use "transparent" as the color, but really for that just use "padding" instead.


    OK, I do have to expound on margins...
    Margins COLLAPSE, vertically.
    That means if you have an element with no margin at the top, for example, and it contains another element with a margin top of 50px; it will be as if your contain element had the 50px margin-top and your contained element had no margin top. In other words it would appear to be a white border. This shouldn't be the case however, if what you see is space to the sides of the element as margin collapse only happens on top and bottom.

    I hope this clears things up for you.

    If you are still stuck , and post your HTML and CSS code , I can take a quick look.


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •