Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 3 of 3
  1. #1
    New Coder
    Join Date
    Nov 2009
    Posts
    16
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Help with layout

    hi!!
    can some1 tel me how to center a web document? likem the page should expan and contract when the browser window is resized..
    thanks..

  • #2
    met
    met is offline
    Regular Coder
    Join Date
    Oct 2009
    Location
    United Kingdom
    Posts
    728
    Thanks
    4
    Thanked 119 Times in 119 Posts
    you can center a document using css

    PHP Code:
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
            "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"
    >
    <
    html xmlns="http://www.w3.org/1999/xhtml">

    <
    head>
       <
    title>Centered Page</title>

    <
    style type="text/css">
    #wrapper { 
    width:974px
    margin:auto;  
    height:500px/* for display purposes */
    background:red;
    }
    </
    style>
    </
    head>
    <
    body>
    <
    div id="wrapper">
    <
    h1>This DIV is centered..</h1>
    <
    div>
    </
    body>

    </
    html

  • #3
    Master Coder Excavator's Avatar
    Join Date
    Dec 2006
    Location
    Alaska
    Posts
    9,675
    Thanks
    22
    Thanked 1,827 Times in 1,811 Posts
    How many times do you plan on asking this question?

    http://www.codingforums.com/showthread.php?t=182486
    http://www.codingforums.com/showthread.php?t=182485
    http://www.codingforums.com/showthread.php?t=182483
    http://www.codingforums.com/showthread.php?t=182480

    If the previous 4 threads have not answered it to your satisfaction, maybe you should post some code of an actual attempt on your part to write something. That way, you could explain in more detail what you're trying to do.
    Validate often DURING development - Use it like a splelchecker | Debug during Development |Write it for FireFox, ignore IE
    Use the right DocType | Validate your markup | Validate your CSS | Why validating is good | Why tables are bad


  •  

    Posting Permissions

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