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
    Regular Coder
    Join Date
    Jun 2010
    Posts
    163
    Thanks
    10
    Thanked 0 Times in 0 Posts

    Stretching Content Area

    Hi,
    I'm currently creating my html/css template for my site.
    I have the site split into 2 sections (Header, Content)
    My Content area is also split into 3 sections. This is because I have sliced the image that will be the background of my content. The first section shows the top of the rounded box for the content. The Second shows the whitespace (Area that will show content). The third shows the bottom of the rounded box.

    I need the middle content area to have a default height of about 500px. However, if the content requires over than 500px, it will automatically stretch to fit that page's needs.

    Below is a picture of my content area. It currently is not stretching to fit all the text.

    http://img530.imageshack.us/img530/1...atecontent.jpg

    Here is my HTML. And below that is my stylesheet.
    Code:
    <html>
    <head>
    <title>Template</title>
    <link rel="stylesheet" type="text/css" href="styles/style.css" />
    </head>
    <body bgcolor="#343331">
    
    <!-- Header -->
    <div id="header">
    	<div id="headerleft">&nbsp;</div>
    	<div id="headermiddle"><p><a href="index.php"><img src="img/logo.png"></a>&nbsp;</p></div>
    	<div id="headerright">
    	</div>
    	
    </div>
    
    <!-- Content Top -->
    <div id="contenttop">
    
    </div>
    
    <!-- Content Middle -->
    <div id="contentmiddle">
    	<div id="content">
    Hello<br />
    	</div>
    </div>
    
    <!-- Content Bottom -->
    <div id="contentbottom">
    
    </div>
    
    </body>
    </html>

    Code:
    #header{
    	width: 912px;
    	height: 78px;
    	background:url(../img/bggreen_header.png) no-repeat;
    	margin-left: auto;
    	margin-right: auto;
    }
    #headerleft{
    	width: 249px;
    	height: 78px;
    	text-align: center;
    	float: left;
    }
    #headermiddle{
    	width: 414px;
    	height: 78px;
    	text-align: center;
    	float: left;
    }
    #headerright{
    	width: 249px;
    	height: 78px;
    	text-align: center;
    	float: left;
    }
    
    body{
    	margin-top: 25px;
    }
    #contenttop{
    	width: 912px;
    	height: 50px;
    	background:url(../img/content_top_1.png) no-repeat;
    	margin-left: auto;
    	margin-right: auto;
    }
    #contentmiddle{
    	width: 912px;
    	height: 500px;
    	background:url(../img/content_middle.png);
    	margin-left: auto;
    	margin-right: auto;
    	z-index: 10;
    }
    #contentbottom{
    	width: 912px;
    	height: 30px;
    	background:url(../img/content_bottom.png) no-repeat;
    	margin-left: auto;
    	margin-right: auto;
    }
    #content{
    	width: 850px;
    	height: 100%;
    	margin-left: auto;
    	margin-right: auto;
    	z-index: 20;
    }
    img{
    	border: none;
    }
    Thanks.

  • #2
    Senior Coder Rowsdower!'s Avatar
    Join Date
    Oct 2008
    Location
    Some say it's everything.
    Posts
    2,027
    Thanks
    5
    Thanked 397 Times in 390 Posts
    How about this:
    Code:
    #contentmiddle{
    	width: 912px;
    	min-height: 500px;
    	background:url(../img/content_middle.png);
    	margin-left: auto;
    	margin-right: auto;
    	z-index: 10;
    }
    The object of opening the mind, as of opening the mouth, is to shut it again on something solid. –G.K. Chesterton
    See Mediocrity in its Infancy
    It's usually a good idea to start out with this at the VERY TOP of your CSS: * {border:0;margin:0;padding:0;}
    Seek and you shall find... basically:
    validate your markup | view your page cross-browser/cross-platform | free web tutorials | free hosting


  •  

    Posting Permissions

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