CSS Question - Padding / Margins

Discussion in 'Web Design and Development' started by mikes63737, Mar 3, 2009.

  1. mikes63737 macrumors 65816

    Joined:
    Jul 26, 2005
    #1
    I'm trying to make a div be the width of the page, minus 200 px on each side.

    So, on a 1000 px wide display it would be like this...
    |--200px--|-----------600 px----------|--200px--|


    And on a 2000 px wide display it would be like this...
    |--200px--|-----------------1600 px----------------|--200px--|


    How can I do this without it flowing over the edge of the page?
     
  2. angelwatt Moderator emeritus

    angelwatt

    Joined:
    Aug 16, 2005
    Location:
    USA
    #2
    Just basing this off hand, but one idea,

    Code:
    div {
     left: 200px;
     right: 200px;
    }
    This is just a starter piece, but I think it would be an easy effort.
     
  3. mikes63737 thread starter macrumors 65816

    Joined:
    Jul 26, 2005
  4. memco macrumors 6502

    Joined:
    May 1, 2008
    #4
    Could also specify the margins as {margin: 0 200px;}.
     

Share This Page