Link to home
Start Free TrialLog in
Avatar of adam1h
adam1hFlag for Belgium

asked on

CSS layout combining fixed and relative elements

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) --->
		<cfelse>
			<cfset variables.columnwidth = 50>
			<cfset variables.productswidth = variables.columnwidth>
		</cfif>
		
		<!--- display side Bar & productsThumbs --->
		<cfoutput>
			<!--- 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#%;">
				<table>
					<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/>
									</div>
									<!--- 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()#..."
																							onclick="processing();document.location.href='#request.targetCFC.getUrl()#';">
										<input type="button" class="productsButtons submit"	value="#request.targetCFC.getAddToBasketLabel()#"
																							onclick="processing();document.location.href='#request.targetCFC.getUrl()#';"> <br/>
									</div>
								</div>
							</td>
						<cfif variables.columnCounter EQ session.productsColumns - 1>
							</tr>
							<cfset variables.columnCounter = 0>
						</cfif>
					</cfloop>
					<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>
								</tr>
								<cfset variables.columnCounter = 0>
							</cfif>
						</cfloop>
					</cfif>
				</table>
			</div>
		</cfoutput>
	</cfif>
</div>

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 {
	display:block;
	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.
Avatar of COBOLdinosaur
COBOLdinosaur
Flag of Canada image

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.

Cd&
ASKER CERTIFIED SOLUTION
Avatar of Jagadishwor Dulal
Jagadishwor Dulal
Flag of Nepal image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of adam1h

ASKER

Hi both,

Thanks To point this to me.

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

ASKER

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.

Thanks