2 Column Liquid Layout, Left Side Menu, No Header, Footer

The 2-column fluid layout with left side menu and footer has five divs:

  1. #bodywrapper. The sole purpose of this div is to provide the background image (in this case, body_bg.gif) for the #contentarea div. Should the height of the #contentarea div be greater than that of the #leftcolumn (menu) div, then the background will tile accordingly.
  2. #leftcolumn. This is the floating menu div, but initially contains no content. The content is supplied by the Javascript.
  3. #contentarea. This is the div that will contain the content of the page. This div is the first div containing content of any type that will appear in the HTML output.
     
    This will serve the dual purpose of providing search engines with a quick and easy way to determine the content of a page, as well as allowing users to view content as soon as possible.
     
    #contentarea is a fluid div, and will expand to the lesser of the available width of the user’s browser window (the width of the window minus the width of the #leftcolumn div) or to the width of the content itself.

  4. #leftcolumncontent. This is the absolutely positioned menu div, and it contains the menu content intended for #leftcolumn. The content of the #leftcolumncontent div is then placed into the #leftcolumn div by the Javascript to create a true two-column layout. The reason for this substitution is explained below.
  5. #footer. This is the footer div. It can be used for copyright notices, for less important links (e.g. legal/disclaimer links), for another version of the main menu, or any other purpose that you like.
     
    The footer can be either fixed or liquid in width. This will not affect the overall layout. Personally, I prefer liquid footers because I find them more attractive as a general rule of thumb, but play with this and see what works best for you.

Notes on the Javascript

This layout also incorporates a Javascript (2_column_replace_divs.js). Should the height of the #leftcolumncontent div be greater than that of the #contentarea div, it will flow over into the #footer div by default. This is due to the fact that absolutely positioned elements are removed from the flow of an HTML document and as such, are either obscured by or overlap other intersecting elements (e.g. the #footer div).

For more information, please read The W3C’s explanation of Absolute Positioning.

To circumvent this issue, I have written a Javascript that will read the contents of the #leftcolumncontent div, move them to the #leftcolumn div, and then clear and remove the #leftcolumncontent div from the visible area of the page. This means that, for those users with Javascript enabled, they will see a two-column, scalable layout. And for those users who have Javascript disabled, they will still see a similar layout as long as the height of #leftcolumncontent does not exceed that of #contentarea. The only users who are negatively affected are those who have Javascript disabled and are viewing pages where the height of #leftcolumncontent exceeds that of #contentarea. At the present time, there is no known alternative.

The CSS

/* This is just here for formatting purposes.  This has nothing to do with the layout. */
@import url(https://searchenginefriendlylayouts.com/wp-content/themes/1cxt1iauxdb3qr75671ky145684/files/css/defaultstyles.css);
body {
/* Always use margin:  0;  padding:  0; as margin controls for your page itself.  Setting both to 0 ensures that your page will spread to the outer edges of the browser window. */
	margin:  0;
	padding:  0;
}
#bodywrapper {
	margin:  0;
	padding:  0;
/*  Background of the left side menu.  Replace the URL and the background color (#FFFFFF) with your choices for each.)  */
	background:  url(../LayoutImages/body_bg.gif) top left repeat-y #FFFFFF;
	color:  #000000;
}
#contentarea {
 /* replace this value with the width of your left column */
	margin-left:  200px;
	margin-right:  0;
	margin-bottom:  0;
	margin-top:  0;
	padding:  0;
	float:  none;
	height:  1%;  /* IE hack due to a bug handling float:  left. */
}
#leftcolumn {
	float:  left;
	width:  200px;
}
#leftcolumncontent {
	position:  absolute;
	top:  0;
	left:  0;
/*  Background of the left side menu.  Replace the URL and the background color (#3F9BCF) with your choices for each.)  */
	background:  url(../LayoutImages/body_bg.gif) top left repeat-y #3F9BCF;
	color:  #FFFFFF;
	margin:  0;
	padding:  0;
/* Replace width with the width of your left column. */
	width:  200px;
}
#footer {
/* This is needed to ensure that the footer appears below your content and menus. */
	clear:  both;
	margin:  0;
	padding:  0;
	width:  100%;
/* Replace with the height of your footer.  Optional.  */
	height:  20px;
/* Replace with the background image and colour of your footer.  */
	background:  url(../LayoutImages/body_bg.gif) #3F9BCF;
	color:  #FFFFFF;
}

The HTML

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>Your Title Tag Here</title>
<meta http-equiv="content-type" content="text/html; charset=iso-8859-1" />
<meta name="keywords" content="Your, keywords, here." />
<meta name="description" content="Your Description Here." />
<link rel="stylesheet" type="text/css" href="/layout_CSS/2_col_left_side_menu_liquid_no_header_footer.css" />
<!--
<![CDATA[
Javascript to replace the contents of the floating div with those of the absolutely positioned div, and clear the absolutely positioned div.  This will ensure a true two column layout.
To ensure that the script works, place the call to the script between the <head> and </head> tags of your document.
]]>
-->
<script type="text/javascript" src="layout_scripts/2_column_replace_divs.js">
<!-- 
//-->
</script>
</head>
<body>
<div id="bodywrapper">
	<div id="leftcolumn"></div>
	<div id="contentarea">
		<h1>Your Header Here</h1>
		Your body content here.
	</div>
</div>
<div id="leftcolumncontent">
	Left Side Content
</div>
<!-- 
<![CDATA[
Javascript function to replace the contents of the floating div (leftcolumn) with those of the absolutely positioned div (leftcolumncontent), and clear the absolutely positioned div.  This will ensure a true two column layout. 
You may replace the last two parameters ("images/body_bg.gif" and "#3F9BCF") with the background and background color of your left side column, respectively.  The first two should be left alone, however.
IMPORTANT:  the function must be called after both the two floating columns and the absolutely positioned column are loaded, or it will not work. 
]]>
-->
<script type="text/javascript">
<!-- 
replaceDivs ("leftcolumn", "leftcolumncontent", "images/body_bg.gif", "#3F9BCF")
-->
</script>
<div id="footer">
	Footer Content
</div>
</body>
</html>

The Javascript

// Functions to be used with the 2-column, liquid layout with header and footer or 
// 2-column, fixed-width layout with header and footer at http://www.searchenginefriendlylayouts.com.
// This code may be freely distributed and used in any commercial or non-commercial application, as long as
// these comments are maintained.  All other comments may be removed.

function clearOld (absoluteDivName) {
	// hides a div and absolutely positions it outside of the viewable area of the page.
	var absoluteDiv = document.getElementById(absoluteDivName);
	absoluteDiv.style.visibility = 'hidden';
	absoluteDiv.style.overflow = 'hidden';
	absoluteDiv.style.display = 'none';
	absoluteDiv.style.top = '-2px';
	absoluteDiv.style.left = '-2px';
	absoluteDiv.style.width = '1px';
	absoluteDiv.style.height = '1px';
}
function replaceDivs(floatDivId, absoluteDivId, floatDivIdBG, floatDivIdBGColor) {
	// This function replaces the contents of the floating div with the contents of the absolutely positioned div.
	var floatDiv = document.getElementById(floatDivId);
	var absoluteDiv = document.getElementById(absoluteDivId);
	var leftHTML = absoluteDiv.innerHTML;
	floatDiv.innerHTML = leftHTML;
	// clear the inner HTML of the absolutely positioned div and hide it to be safe.
	absoluteDiv.innerHTML = null;
	clearOld (absoluteDivId);
	// assign background and background color to the floating div.
	var bgStyle = 'url( + floatDivIdBG + ) top left repeat-y ' + floatDivIdBGColor;
	floatDiv.style.background = bgStyle;
}

2-Column Layouts

2 Column, Liquid, Left Side Menu, Header, Footer 2 Column, Liquid, Right Side Menu, Header, Footer 2 Column, Fixed Width, Right Side Menu, Header, Footer 2 Column, Fixed Width, Left Side Menu, Header, Footer 2 Column, Liquid, Right Side Menu, Header 2 Column, Liquid, Left Side Menu, Header 2 Column, Fixed Width, Left Side Menu, Header 2 Column, Fixed Width, Right Side Menu, Header 2 Column, Liquid, Left Side Menu, Footer 2 Column, Liquid, Right Side Menu, Footer 2 Column, Fixed Width, Right Side Menu, Footer 2 Column, Fixed Width, Left Side Menu, Footer 2 Column, Liquid, Right Side Menu 2 Column, Liquid, Left Side Menu 2 Column, Fixed Width, Left Side Menu 2 Column, Fixed Width, Right Side Menu

Fixed Width Layouts

3 Column, Fixed Width, Header, Footer 3 Column, Fixed Width, Header 3 Column, Fixed Width, Footer 3 Column, Fixed Width 2 Column, Fixed Width, Right Side Menu, Header, Footer 2 Column, Fixed Width, Left Side Menu, Header, Footer 2 Column, Fixed Width, Right Side Menu, Header 2 Column, Fixed Width, Left Side Menu, Header 2 Column, Fixed Width, Right Side Menu, Footer 2 Column, Fixed Width, Left Side Menu, Footer 2 Column, Fixed Width, Right Side Menu 2 Column, Fixed Width, Left Side Menu

Layouts With Headers

3 Column, Liquid, Header, Footer 3 Column, Fixed Width, Header, Footer 3 Column, Liquid, Header 3 Column, Fixed Width, Header 2 Column, Liquid, Right Side Menu, Header, Footer 2 Column, Liquid, Left Side Menu, Header, Footer 2 Column, Fixed Width, Right Side Menu, Header, Footer 2 Column, Fixed Width, Left Side Menu, Header, Footer 2 Column, Liquid, Right Side Menu, Header 2 Column, Liquid, Left Side Menu, Header 2 Column, Fixed Width, Right Side Menu, Header 2 Column, Fixed Width, Left Side Menu, Header
Warning:  This Site's Layout Will Change