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

Thread: Centering boxes

  1. #1
    New Coder
    Join Date
    Aug 2007
    Posts
    71
    Thanks
    17
    Thanked 0 Times in 0 Posts

    Centering boxes

    I have some boxes on my site that appear on the right side of the screen. I would like to center them on the page. If you look at the page source, you'll see I am using HTML code, so maybe I am limited. I have tried modifying this piece of code:

    <div id="body-right">

    changing it to this:

    <div id="body-center">

    This works for centering everything, however, the boxes disappear! Any thoughts? Thanks! link --> www.maxxtraining.com/coaching.htm

  • #2
    Master Coder Excavator's Avatar
    Join Date
    Dec 2006
    Location
    Alaska
    Posts
    9,672
    Thanks
    22
    Thanked 1,827 Times in 1,811 Posts
    Hello billvasko,
    It's going to be easier to center things if you have a doctype. Check the links in my sig or the sticky at the top of this forum.

    I see now you have one, you just have a <title> above it. Make your doctype the very first line.
    You will need some changes to get XHTML strict to validate.
    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

  • #3
    Master Coder Excavator's Avatar
    Join Date
    Dec 2006
    Location
    Alaska
    Posts
    9,672
    Thanks
    22
    Thanked 1,827 Times in 1,811 Posts
    Right now, #body-right {float: right;width: 384px;} has your boxes going over to the right.

    Change this to
    Code:
    #body-right {
    	width: 384px;
    	margin: 0 auto;
    }
    and your boxes will center.
    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
    •