CSS layout combining fixed and relative elements

Posted on 2013-05-17
Medium Priority
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="#application.pictures.thumbsPath##variables.product.getReferenceId()#.jpg" />
								</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 2000 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

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

Originally, this post was published on Monitis Blog, you can check it here . Websites are getting bigger and more complicated by the day. Video, images and custom fonts are all great for showcasing your product or service. But the price to pay in…
Australian government abolished Visa 457 earlier this April and this article describes how this decision might affect Australian IT scene and IT experts.
The viewer will learn how to create and use a small PHP class to apply a watermark to an image. This video shows the viewer the setup for the PHP watermark as well as important coding language. Continue to Part 2 to learn the core code used in creat…
The viewer will learn the basics of jQuery including how to code hide show and toggles. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery…
Suggested Courses

777 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