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 5 of 5
  1. #1
    New to the CF scene
    Join Date
    Jan 2013
    Posts
    9
    Thanks
    7
    Thanked 0 Times in 0 Posts

    Background color in div column - stretch 100% vertical?

    I have a 3 column liquid layout. All columns are liquid: .sidebar1 (left is blue color background - no images) .content (middle is white background - no problems) and .sidebar2 (right is blue background color). 20% - 60% -20%. They live within .container which sets full page view at 90% with max-width: 1260px and min-width: 780px.

    I'm struggling with an issue that seems common but I have not found a solution that works yet. The center column (.content) varies in length on a number of pages based on how much info and text the page contains. Some are long and scroll.

    The content in sidebar1 div column and sidebar2 div column is generally not as long as the .content column. The result is a short blue colored column on the left and a short blue colored column on the right.

    I would like those two blue columns to stretch to the bottom of the page on all pages regardless of the amount of text & stuff in the .content div, hopefully using only the background color property instead of an image. (I think the flexible nature of the 2 sidebars would make an image background too complicated and possibly inconsistent across browsers and screen resolutions.)

    Initially, I messed and messed with 4 main divs plus a footer div. No luck no matter what tweak I applied. After searching a lot, it looks as though I need to place the 2 .sidebar columns within a container so I've created .sidebar1container and .sidebar2container and wrapped those around .sidebar1 and .sidebar 2..

    Am I on the right track? Is anyone familiar with this issue and have a potential solution?

    Code:
    Original HTML
    HTML
    <div class="container">
    <div class="sidebar1">
    <div class="content">
    <div class="sidebar2">
     
    Original CSS
    .container {
    	width: 90%;
    	max-width: 1260px;
    	min-width: 780px;
    }
     
    .sidebar1 {
    	float: left;
    	width: 20%;
    	background-color: #93A5C4;
    	padding-bottom: 10px;
    	color: #FFF;
     
    }
     
    .sidebar2 {
    	float: left;
    	width: 20%;
    	background-color: #93A5C4;
    	padding: 1px 0;
     
    }
     
    .content {
    	padding: 10px 0;
    	width: 60%;
    	float: left;
    }
    
    NEW HTML direction
    <div class="container">
    <div class="sidebar1container"
         <div class="sidebar1"></div>
    </div>
    <div class="content"></div>
    <div class="sidebar2container">
         <div class="sidebar2"></div>
    </div>
     
    NEW CSS direction
    .container {
    	width: 90%;
    	max-width: 1260px;
    	min-width: 780px;
    }
    
    .sidebar1container {
    ????	
    }
    
    .sidebar1 {
    	float: left;
    	width: 20%;
    	background-color: #93A5C4;
    	padding-bottom: 10px;
    	color: #FFF;
     
    }
     
    .sidebar2container {
    ???
    }
    
    .sidebar2 {
    	float: left;
    	width: 20%;
    	background-color: #93A5C4;
    	padding: 1px 0;
     
    }
     
    .content {
    	padding: 10px 0;
    	width: 60%;
    	float: left;
    }
    Thanks for looking.

  • #2
    Master Coder Excavator's Avatar
    Join Date
    Dec 2006
    Location
    Alaska
    Posts
    9,695
    Thanks
    22
    Thanked 1,832 Times in 1,816 Posts
    Hello pilsnermonkey,
    I'm not sure the point of nesting your sidebars in sidebar containers. I think one of the indicators of divitis is when you can't come up with any styling for an element. -
    Code:
    .sidebar1container { ????
    }.sidebar2container { ???
    }
    Normally the solution to your problem would be faux columns. Google that for a ton of examples. Since your layout is in %'s, faux columns may not work so well.
    Have a look a this jQuery solution - http://nopeople.com/CSS%20tips/jQuer...mns/index.html
    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

  • Users who have thanked Excavator for this post:

    pilsnermonkey (01-20-2013)

  • #3
    New to the CF scene
    Join Date
    Jan 2013
    Posts
    9
    Thanks
    7
    Thanked 0 Times in 0 Posts
    Perfect. That is beautiful. Works perfectly. Thank you so so much! Really appreciate the help Excavator. Helpful Member +++

  • #4
    New to the CF scene
    Join Date
    Jan 2013
    Posts
    9
    Thanks
    7
    Thanked 0 Times in 0 Posts
    Just one afterthought. If you happen to know of the top of your head: prior to introducing that HTML5 bit, my page was an XHTML doctype. I changed that to HTML doctype prior to adding the <aside> tags. Is that a necessity or would the HTML 5 bits work in an XHTML doctype environment?

    Also, are the <aside> tags in any way dependent on the <section> tag or should they be happy all on their own?

  • #5
    Master Coder Excavator's Avatar
    Join Date
    Dec 2006
    Location
    Alaska
    Posts
    9,695
    Thanks
    22
    Thanked 1,832 Times in 1,816 Posts
    Quote Originally Posted by pilsnermonkey View Post
    Just one afterthought. If you happen to know of the top of your head: prior to introducing that HTML5 bit, my page was an XHTML doctype. I changed that to HTML doctype prior to adding the <aside> tags. Is that a necessity or would the HTML 5 bits work in an XHTML doctype environment?
    There are plenty of new elements that depend on the HTML5 DocType Declaration and won't be recognized by an XHTML DocType.


    Also, are the <aside> tags in any way dependent on the <section> tag or should they be happy all on their own?
    You can find hours of reading on the new HTML5 elements and the correct way to use them. Here's a start - http://html5doctor.com/element-index/
    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
    •