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 2 of 2
  1. #1
    New Coder
    Join Date
    Aug 2009
    Posts
    25
    Thanks
    4
    Thanked 0 Times in 0 Posts

    100% Width and Align Center Problem

    Hello,

    I use generally simple layout like..

    In my <body> I start with a <section> for a full table and go on adding <article id="top_part"> for logo - menu

    and then another <section> part for the content part and goes on...

    My question is :

    1) When I arrange the width of my first section to 100% it leaves blank space on top and left side. Also the right side flows over the browser a bit.

    2) When I arrange my sub sections or article which are under my first section to have margin:0 auto; they are not centered. They have {float:left; border:0; margin:0 auto;}

    Why are not they centered?

    Cheers

  • #2
    Regular Coder
    Join Date
    Aug 2005
    Location
    MS
    Posts
    820
    Thanks
    10
    Thanked 78 Times in 76 Posts
    1/2) Can't center an element with 100% width or a float set.

    Without code used (HTML/CSS), hard to tell you what would fix blank spaces.

    Examples:
    Code:
    body {
    width: 90%;
    height: 600px; /* optional */
    margin: 0 auto;
    background: #fff url(path to non-tiled image) no-repeat center scroll;
    }
    
    Example as a Class:
    
    .selector_name {
    width: 90%;
    height: 600px; /* optional */
    margin: 0 auto;
    background: #fff url(path to non-tiled image) no-repeat center scroll;
    }
    
    HTML for Class: <div class="selector_name">Content here</div>
    ☠ ☠RON☠ ☠


  •  

    Posting Permissions

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