Strange Space to the right of page

Discussion in 'HTML & Website Design' started by grusomhat, Jun 10, 2007.

  1. #1
    grusomhat, Jun 10, 2007 IP
  2. Dan Schulz

    Dan Schulz Peon

    Messages:
    6,032
    Likes Received:
    436
    Best Answers:
    0
    Trophy Points:
    0
    #2
    You're setting a width of 100% on your elements, then adding borders and padding to them - BAD idea. What you're doing is tacking on the width of the borders and padding to the width of the elements, which is causing them to be greater than 100%.

    I also suggest you remove the margin: 0; padding: 0; declarations in your style rules and replace them with the universal selector:
    
    * {
        margin: 0;
        padding: 0;
    }
    
    Code (markup):
    This will remove the margins and padding from everything, freeing you to add the exact amounts of each to those HTML elements that need it. Warning: Will cause margins and padding on form controls (input, select, etc...) to collapse. use with caution and great care when incorporating forms onto a page.
     
    Dan Schulz, Jun 10, 2007 IP
  3. grusomhat

    grusomhat Peon

    Messages:
    277
    Likes Received:
    5
    Best Answers:
    0
    Trophy Points:
    0
    #3
    Sweet that's fixed it. I've just taken the width away totally and it's working properly now.

    I also added the universal rule with borders: 0; as well. Works well and it will save me a lot of extra code.
     
    grusomhat, Jun 10, 2007 IP
  4. Dan Schulz

    Dan Schulz Peon

    Messages:
    6,032
    Likes Received:
    436
    Best Answers:
    0
    Trophy Points:
    0
    #4
    I wouldn't do that with borders - it messes up form controls way too much to even be worth it (besides, the default for borders is "0" anyway on most elements).
     
    Dan Schulz, Jun 10, 2007 IP
  5. grusomhat

    grusomhat Peon

    Messages:
    277
    Likes Received:
    5
    Best Answers:
    0
    Trophy Points:
    0
    #5
    Hmm, I'll change it back. Thanks for the help
     
    grusomhat, Jun 10, 2007 IP