+ Reply to Thread
Page 1 of 2 12 LastLast
Results 1 to 10 of 11
Like Tree2Likes

Thread: CSS Layout Not Fluid

  1. #1
    kbjradmin's Avatar
    kbjradmin is offline x10 Elder kbjradmin is an unknown quantity at this point
    Join Date
    Feb 2008
    Location
    Washington State, USA
    Posts
    512

    CSS Layout Not Fluid

    ok, so i made this layout in css, and from what i can tell, it should be fluid, but its not. i don't understand why the whole page won't expand with the main content. here is the code:

    index.php
    HTML Code:
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
    <?php include('config.php'); ?>
    <html xmlns="http://www.w3.org/1999/xhtml">
    
    <head>
        
        <!--Data Tags-->
            <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
            <meta http-equiv="Content-Language" content="en" />
            <title><?php echo $pageTitle; ?></title>
            
        <!--File Includes-->
        
            <!--CSS Files-->
                <link rel="stylesheet" type="text/css" href="style.css" />
                <link rel="stylesheet" type="text/css" href="background.css" />
                
            <!--Script Files-->
                <script type="text/javascript" src="scripts/onPageLoad.js"></script>
            
            <!--Other Files-->
                <link rel="shortcut icon" href="media/favicon.ico" />
        
    </head>
    
    <body>
    
        <div id="wrapper-background">
        
        
            <!--Top-->
                <div id="wb-top">
                    <div class="wb-left"></div>
                    <div class="wb-right"></div>
                    <div class="wb-center">
                        <div id="header">
                            <h1>Header</h1>
                        </div>
                    </div>
                </div>
            
            <!--Middle-->
                <div id="wb-middle">
                    <div class="wb-left"></div>
                    <div class="wb-right"></div>
                    <div class="wb-center">
        
                        <div id="wrapper-content">
            
                            
                            
                            <div id="navagation">
                            </div>
                            
                            <div id="main">
                            
                                <div class="left">
                                    <p style="text-align:center;">Main Left</p>
                                </div>
                                
                                <div class="right">
                                    <p style="text-align:center;">Main Right</p>
                                </div>
                                                        
                                <div class="center">
                                    <p style="text-align:center;">Main Center</p>
                                </div>
                                
                                <div class="clear"></div>
                            
                            </div>
                            
    
                        
                        </div>
        
                    </div>
                </div>
            
            <!--Bottom-->
                <div id="wb-bottom">
                    <div class="wb-left"></div>
                    <div class="wb-right"></div>
                    <div class="wb-center">
                        <div id="footer">
                            <?php echo $footerCode; ?>
                        </div>
                    </div>
                </div>
            
        </div>
    
    </body>
    
    </html>
    style.css
    Code:
    @charset "utf-8";
    
    *{
        margin: 0 0 0 0;
        padding: 0 0 0 0;
        font-family: Comic Sans MS, Comic Sans MS5, cursive;
        font-weight: 100;
    }
    
    a{
        color: #3f9ce9;
        text-decoration: none;
    }
    
    a:hover{
        text-decoration: underline;
    }
    
    .clear{
        clear: both;
    }
    
    body{
        background-image: url('media/background.png');
        background-position: left top;
        background-attachment: scroll;
        background-repeat: repeat-x;
        background-color: #ffffff;
    }
    
    #wrapper-background{
        width: 95%;
        margin: 2em auto 2em auto;
        position: relative;
        min-height: 250px;
    }
    
    
    
    
    
    #header{
        font-size: 20px;
    }
    
    #main .left{
        float: left;
        width: 15%;
    }
    
    #main .right{
        float: right;
        width: 15%;
    }
    
    #footer{
        margin-top: 20px;
    }
    
    #footer .left{
        float: left;
    }
    
    #footer .right{
        float: right;
    }
    background.css
    Code:
    @charset "utf-8";
    
    
    
    /*
    Top Row
    */
    
    #wb-top .wb-left{
        position: absolute;
        top: 0px;
        left: 0px;
        background: url('media/top-left.png');
        width: 50px;
        height: 50px;
    }
    
    #wb-top .wb-right{
        position: absolute;
        top: 0px;
        right: 0px;
        background: url('media/top-right.png');
        width: 50px;
        height: 50px;
    }
    
    #wb-top .wb-center{
        position: absolute;
        top: 0px;
        left: 50px;
        right: 50px;
        background: url('media/top.png');
        height: 50px;
    }
    
    
    
    /*
    Middle Row
    */
    
    #wb-middle .wb-left{
        position: absolute;
        top: 50px;
        left: 0px;
        bottom: 50px;
        background: url('media/left.png');
        width: 50px;
    }
    
    #wb-middle .wb-right{
        position: absolute;
        top: 50px;
        right: 0px;
        bottom: 50px;
        background: url('media/right.png');
        width: 50px;
    }
    
    #wb-middle .wb-center{
        position: absolute;
        top: 50px;
        right: 50px;
        bottom: 50px;
        left: 50px;
        background-color: #ffffff;
    }
    
    
    
    /*
    Bottom Row
    */
    
    #wb-bottom .wb-left{
        position: absolute;
        bottom: 0px;
        left: 0px;
        background: url('media/bottom-left.png');
        width: 50px;
        height: 50px;
    }
    
    #wb-bottom .wb-right{
        position: absolute;
        bottom: 0px;
        right: 0px;
        background: url('media/bottom-right.png');
        width: 50px;
        height: 50px;
    }
    
    #wb-bottom .wb-center{
        position: absolute;
        bottom: 0px;
        left: 50px;
        right: 50px;
        background: url('media/bottom.png');
        height: 50px;
    }
    please help!
    dinomirt96 likes this.

  2. #2
    leafypiggy's Avatar
    leafypiggy is offline Community Advocate leafypiggy is on a distinguished road
    Join Date
    Aug 2007
    Location
    Massachusetts
    Posts
    2,228

    Re: CSS Layout Not Fluid

    Can you link us to your site? Might help to have a copy to look at.
    Neil Hanlon | x10Hosting Support Representative
    Neil[at]x10hosting.com
    █ I'm always happy to help. Just ask a question in Free Hosting
    Terms of Service IRC

  3. #3
    kbjradmin's Avatar
    kbjradmin is offline x10 Elder kbjradmin is an unknown quantity at this point
    Join Date
    Feb 2008
    Location
    Washington State, USA
    Posts
    512

    Re: CSS Layout Not Fluid

    here's a link to the page.
    http://www.kbjrweb.com/template1/

  4. #4
    misson is offline x10 Spammer misson is a jewel in the rough
    Join Date
    Mar 2008
    Location
    Libertatia
    Posts
    2,506

    Re: CSS Layout Not Fluid

    Quote Originally Posted by kbjradmin View Post
    ok, so i made this layout in css, and from what i can tell, it should be fluid, but its not. i don't understand why the whole page won't expand with the main content.
    It would also be useful if you were more descriptive. What, precisely, is the behavior you want? What is the behavior you get? What browsers are you testing?

    The only issue I see is on Safari 3.2, where the #wrapper-background and #wb-bottom elements aren't containing the "Valid XHTML and CSS" notice. This is because you're using absolute positioning, which takes elements out of the normal flow. Use floating (or inline elements) rather than absolute positioning to place elements horizontally.

    The page looked fine under Firefox 3. I didn't test any version of IE.

  5. #5
    kbjradmin's Avatar
    kbjradmin is offline x10 Elder kbjradmin is an unknown quantity at this point
    Join Date
    Feb 2008
    Location
    Washington State, USA
    Posts
    512

    Re: CSS Layout Not Fluid

    it looks fine because i gave the content div a min-height. if that is removed, or if more content is added, i want the container to expand with the content.

  6. #6
    misson is offline x10 Spammer misson is a jewel in the rough
    Join Date
    Mar 2008
    Location
    Libertatia
    Posts
    2,506

    Re: CSS Layout Not Fluid

    Then the issue is still absolute positioning. It's useful for things like corner images, but not so much for content.

  7. #7
    kbjradmin's Avatar
    kbjradmin is offline x10 Elder kbjradmin is an unknown quantity at this point
    Join Date
    Feb 2008
    Location
    Washington State, USA
    Posts
    512

    Re: CSS Layout Not Fluid

    ok, i've changed it so that it uses margins for the content div, but now it's giving me a different problem. it won't stay inside the center area, it keeps expanding beyond its given area.

  8. #8
    VPmase's Avatar
    VPmase is offline x10 Elder VPmase is an unknown quantity at this point
    Join Date
    Nov 2007
    Location
    Dixon, IL, USA
    Posts
    914

    Re: CSS Layout Not Fluid

    Add
    max-height:##px/%;
    to your CSS

    http://www.w3schools.com/Css/pr_dim_max-height.asp
    Last edited by VPmase; 06-07-2009 at 05:04 AM. Reason: Automerged Doublepost

  9. #9
    xav0989's Avatar
    xav0989 is offline Community Public Relation xav0989 is just really nice
    Join Date
    Jul 2008
    Location
    ifk
    Posts
    4,438

    Re: CSS Layout Not Fluid

    I've added through my firebug
    padding: 50px 0;
    to wb-middle.wb-center
    It is not the best solution, but with absolute positioning, it helps.

    I'd say, go with float, and do a clear: both; after each part.
    Last edited by xav0989; 06-07-2009 at 07:42 AM.
    karimirt47 likes this.
    Xavier L | Community Public Relations Manager (Free Hosting Support)
    █ Yes, my position is too cool to even exist!
    How am I helping? Rate this post by clicking the icon below! (this is even better than "liking" a post)
    Terms of Service | Acceptable Use Policy | x10Hosting Wiki

  10. #10
    kbjradmin's Avatar
    kbjradmin is offline x10 Elder kbjradmin is an unknown quantity at this point
    Join Date
    Feb 2008
    Location
    Washington State, USA
    Posts
    512

    Re: CSS Layout Not Fluid

    @xav0989, i tried adding padding, but it still has a problem. the center div is overhanging the top and bottom divs, creating this odd white outline.


+ Reply to Thread
Page 1 of 2 12 LastLast

Similar Threads

  1. Problem with two column CSS layout and tables
    By gottaloveit in forum Graphics & Webdesign
    Replies: 1
    Last Post: 04-24-2008, 04:19 PM
  2. Replies: 2
    Last Post: 12-16-2006, 08:59 PM
  3. {req} Layout + Members Login Area
    By SEŅOR in forum The Marketplace
    Replies: 8
    Last Post: 04-29-2006, 02:59 PM
  4. (req) Layout
    By SEŅOR in forum The Marketplace
    Replies: 34
    Last Post: 03-01-2006, 07:17 PM
  5. Should i use this layout?
    By IamShipon1988 in forum Graphics & Webdesign
    Replies: 2
    Last Post: 07-28-2005, 07:36 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
x10hosting free hosting for the masses
dedicated servers