CSS layout combining fixed and relative elements

Posted on 2013-05-17
Last Modified: 2013-11-19
Hi experts,

I am trying to build a page with a fixed left menu and then products' columns.

I have success, everything works well except :
In Firefox, the background ends below my header (with navigation bar), include my footer, but the main body is uppon all.

In Chrome, Safari, Opera & even in IE it works well, like I wish.

Do you have an idea wtf is this bug ?

You can view the online version HERE

Here are the page products:
<div id="products">
	<cfif variables.viewType.mode EQ "details">
	<cfelseif variables.viewType.mode EQ "thumbs">
		<!--- variable to hold table layout --->
		<cfset variables.columnCounter = 0> <!--- variable to hold columns layout --->
		<cfif session.productsColumns GT 1>
			<cfset variables.columnwidth = 100 / session.productsColumns> <!--- variable to hold columns width --->
			<cfset variables.productswidth = variables.columnwidth * (session.productsColumns - 1)> <!--- variable to hold products part width (without sideBar) --->
			<cfset variables.columnwidth = 50>
			<cfset variables.productswidth = variables.columnwidth>
		<!--- display side Bar & productsThumbs --->
			<!--- display the side bar --->
			<div id="productsSideBar" style="width:#variables.columnwidth#%;"> <cfinclude template="/views/sharedComponents/3a_productsSideBar.cfm"> </div>
			<!--- display the products --->
			<div id="productThumbs" style="width:#variables.productswidth#%;">
					<cfloop array="#variables.products#" index="variables.product">
						<cfset variables.columnCounter ++>
						<cfif variables.columnCounter EQ 1> <tr> </cfif>
							<td class="productThumb" style="width:#variables.columnwidth#%;">
								<!--- the product's picture --->
								<a href="#request.targetCFC.getUrl()#" class="productsLinks" onclick="processing();">
									<img class="productThumbPicture" src="" />
								</a> <br/>
								<!--- products data --->
								<div class="productThumbData">
									<!--- data always displayed --->
									<div class="productThumbDataAlwaysDisplayed">
										#variables.product.getReferenceId()# #variables.product.getName()# <br/>
										Packsize #variables.product.getPacksize()# #variables.product.getAssortmentType()# <br/>
										#session.currency# #evaluate("variables.product.get" & variables.priceActive & "()")# <br/>
									<!--- data displayed on hover --->
									<div class="productThumbDataDisplayedOnHover">
										<input type="button" class="productsButtons"			value="#request.targetCFC.getRangeLabel()#"
																							onclick="processing();document.location.href='#request.targetCFC.getUrl()#';"> <br/>
										<input type="button" class="productsButtons"			value="#request.targetCFC.getMoreDetailsLabel()#..."
										<input type="button" class="productsButtons submit"	value="#request.targetCFC.getAddToBasketLabel()#"
																							onclick="processing();document.location.href='#request.targetCFC.getUrl()#';"> <br/>
						<cfif variables.columnCounter EQ session.productsColumns - 1>
							<cfset variables.columnCounter = 0>
					<cfif variables.columnCounter NEQ 0>
						<cfloop condition="variables.columnCounter NEQ 0">
							<cfset variables.columnCounter ++>
							<td class="productThumb">&nbsp;</td>
							<cfif variables.columnCounter EQ session.productsColumns - 1>
								<cfset variables.columnCounter = 0>

Open in new window

And here is the css involved:
@charset "UTF-8";
/* Contains the css's rules for the global website's parts */

*** Products' parts - General elements ***
/* the div containing the products (all, the page body +/-) */
#products {
/* the links surrounding products' pictures */
.productsLinks {
/* the products' buttons */
.productsButtons {
	float: none;
*** END Products' parts - General elements ***

*** Products' parts - Thumbs ***
/* the part containing the products' side bar */
#productsSideBar {
	float: left;
	position: fixed;
/* the part containing the products thumbs */
#productThumbs {
	float: right;
/* the td containing 1 product thumb (data + image) */
.productThumb {
	text-align: center;
	vertical-align: bottom;
	padding-bottom: 3em;
/* the product's picture */
.productThumbPicture {
	text-align: center;
/* the div containing product's data - all */
.productThumbData {
	text-align: left;
/* the div containing product's data - always visible data */
.productThumbDataAlwaysDisplayed {
/* the div containing product's data - visible on hover data */
.productThumbDataDisplayedOnHover {
	visibility: hidden;
/* the div containing product's data - visible on hover data - hover attributes */
#productThumbs td:hover .productThumbDataDisplayedOnHover {
	visibility: visible;
*** END Products' parts - Thumbs ***

Open in new window

Thanks a lot for your help.
Question by:adam1h
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
LVL 53

Expert Comment

ID: 39176390
The page is junk in all browsers.  There are 93 validation errors; many of them serious.  

The immediate issue is because you have not set a background color on the menu or main content.  Firefox followed the xhtml spec and defaulted the background to transparent.  The other browsers probably don't have a problem because the defective code likely confused them and they rendered wrong and the combination of bad code and weak browser compliance worked in your favor.  

If you leave the page code the way it is, it is going to be unstable and every time you touch it is could just meltdown.

LVL 15

Accepted Solution

Jagadishwor Dulal earned 500 total points
ID: 39176557
Yes there is few errors in your style. As you are productsSideBar and productThumbs two column floating why didn't you clear floating before your footer start.

I have tested using inline style:

<div style=" clear:both;"></div>
<div id="footer">

Open in new window


Author Comment

ID: 39176813
Hi both,

Thanks To point this to me.

I'll try to repair these errors and to add the clear:both; code.

Author Comment

ID: 39185825
Hi Both,

Sorry for late replying.

It works well when adding "clear: both;" to the footer.

With wich tool do you see the error validation ?

I have check with firebug but I see nothing.


Featured Post

How our DevOps Teams Maximize Uptime

Our Dev teams are like yours. They’re continually cranking out code for new features/bugs fixes, testing, deploying, responding to production monitoring events and more. It’s complex. So, we thought you’d like to see what’s working for us. Read the use case whitepaper.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

This article will inform Clients about common and important expectations from the freelancers (Experts) who are looking at your Gig.
FAQ pages provide a simple way for you to supply and for customers to find answers to the most common questions about your company. Here are six reasons why your company website should have a FAQ page
The viewer will learn how to count occurrences of each item in an array.
The viewer will learn how to create a basic form using some HTML5 and PHP for later processing. Set up your basic HTML file. Open your form tag and set the method and action attributes.: (CODE) Set up your first few inputs one for the name and …

733 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question