changing CSS to fixed width of site

Discussion in 'CSS' started by gclass, Jul 19, 2009.

  1. #1
    gclass, Jul 19, 2009 IP
  2. gareth_gillman

    gareth_gillman Peon

    Messages:
    38
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #2
    set a wrapper around all your website between the body tags

    <div id="wrapper">

    </div

    then in the css

    #wrapper {
    width:900px; <!--- change this to how big you want it
    margin:auto; <!--- makes the div centered vertically
    }
     
    gareth_gillman, Jul 19, 2009 IP
  3. gclass

    gclass Active Member

    Messages:
    337
    Likes Received:
    2
    Best Answers:
    0
    Trophy Points:
    55
    #3
    Garreth thanks, but its not working
    the CSS files use ".warpper { " syntax so I tried #wrapper and . wrapper and both dont work.
    and the divs I did like :
    <body>
    <div id="wrapper">
    <?php echo $mainbody; ?>
    </div>
    </body>


    Thanks
     
    gclass, Jul 19, 2009 IP
  4. gareth_gillman

    gareth_gillman Peon

    Messages:
    38
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #4
    change the name of the wrapper then, you could call it "abcdef" but i use wrapper as its easiest

    change it to container so

    <div id="container">

    #container {
    }
     
    gareth_gillman, Jul 19, 2009 IP
  5. wd_2k6

    wd_2k6 Peon

    Messages:
    1,740
    Likes Received:
    54
    Best Answers:
    0
    Trophy Points:
    0
    #5
    Yes just to add when you use an ID within a document you must refer to it with a # inside the CSS and when you use a class within a document you must refer to it with a .
    So for example:

    
    <div [B]id[/B]="header">
    </div>
    
    Code (markup):
    To refer to this div inside your CSS you'd use
    
    #header { //CSS statements }
    Code (markup):
    However if you were to have:
    
    <div [B]class[/B]="header">
    </div>
    
    Code (markup):
    Then to refer to this div inside your CSS you'd use
    
    .header { //CSS statements }
    Code (markup):
    You can use both classes and ID's in your documents and your CSS
     
    wd_2k6, Jul 19, 2009 IP
  6. gclass

    gclass Active Member

    Messages:
    337
    Likes Received:
    2
    Best Answers:
    0
    Trophy Points:
    55
    #6
    I tried to do all the combinations but still not working,
    so I tried to rename each of the CSS files I have one at a time to see which one control the width..
    and no on affected the width of the page!!
    is it possible that a JS file define the site width?

    Thanks
     
    gclass, Jul 19, 2009 IP