3 equalizing col layout +header +footer

Hi BonRouge,

The example above needs quirks mode because I am using padding to in which to place the elements without increasing thge 100% height. As you know this can only be done in the broken box model version.

The problem withh php and the xml prologue is when you have short tags set to on in the php config files (or wherever its kept). If you switch them off then you shouldn’t get conflicts. (I don’t know much php but i remember reading that :).)

Anyway you don’t need to use the xml prologue as you can trigger it by enclosing conmments above the doctype anyway.


<!-- quirks on in ie -->
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "[http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd](http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd)">
<html xmlns="[http://www.w3.org/1999/xhtml](http://www.w3.org/1999/xhtml)">


That will still validate but will cause quirks mode in ie and shouldn’t affect php at all.

If you don’t need the 100% height version then you can do a fixed header in standards mode ok. This code belows puts a drop down menu at the top of the page so its always in view and the page scrolls undereneath. I’ve meaning to put this up as a demo because I don’t thing I’ve seen an example that works this well :slight_smile:

It works in ie5, 5.5 and 6, firefox and opera7.5.


<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "[http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd](http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd)">
<html xmlns="[http://www.w3.org/1999/xhtml](http://www.w3.org/1999/xhtml)">
<head>
<title>Horizontal Drop Down Menus</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<script type="text/javascript">
// JavaScript Document suckerfish menu ala
startList = function() {
if (document.all&&document.getElementById) {
navRoot = document.getElementById("nav");
for (i=0; i<navRoot.childNodes.length; i++) {
node = navRoot.childNodes[i];
if (node.nodeName=="LI") {
node.onmouseover=function() {
this.className+=" over";
  }
  node.onmouseout=function() {
  this.className=this.className.replace(" over", "");
   }
   }
  }
 }
}
window.onload=startList;
</script>
<style type="text/css">
body {background:blue;margin:0;padding:0}
#ddwrap {
 height:22px;
 border-bottom: 1px solid #fff;
 background:#adbcc9;
}
ul#nav{width:790px}
ul#nav, ul#nav ul {
 margin: 0;
 padding: 0;
 list-style: none;
 font-family: Verdana, Arial, Helvetica, sans-serif;
 font-size: 10px;
 font-weight:bold;
 white-space:nowrap;
 background:#adbcc9;
 text-align:center;
 text-transform: uppercase;
 color: #FFFFFF;
}
ul#nav ul{font-weight:normal;text-align:left;}
ul#nav li {
 position: relative;
 float:left;
 margin:0;padding:0;
}
 
ul#nav li ul {
 position: absolute;
 left: 0; 
 top: 100%;
 display: none;
 border:1px solid #fff;
 border-top:none;
 background:#adbcc9;
 width:auto;
 z-index:200;
 text-transform: none;
}
ul#nav li ul li{background:#adbcc9;float:none;}
html>body ul#nav li ul {width:100px}
html>body ul#nav li.ddwide ul {width:140px}
html>body ul#nav li.ddsmall ul {width:80px}
/* Styles for Menu Items */
ul#nav li a {
 display:block;float:left;
 text-decoration: none;
 color: #fff;
 background:#adbcc9; /* IE6 Bug */
 padding: 5px 4px;
 }
/* commented backslash mac hiding hack \\*/ 
* html ul#nav li a {height:1%}
* html ul#nav li {height:1%}
* html ul#nav li ul li{
 white-space:nowrap;
 width:100px;
 margin-left:-16px;
 voice-family: "\\"}\\""; 
 voice-family:inherit;
}
* html ul#nav li ul li{width:1%;ma\\rgin-left:0;}/* ie5 skips this, but ie5.5. and 6 don't */
* html ul#nav li.ddsmall ul {width:80px}
/* end hack */ 
ul#nav li ul li a { 
 float:none;
 white-space:nowrap;
 padding: 2px 4px;
 border:none; 
} /* Sub Menu Styles */

/* this sets all hovered lists  */
ul#nav li:hover a,ul#nav li.over a,
ul#nav li:hover li a:hover,ul#nav li.over li a:hover {
   color: #004173;
}
/* set dropdown to default */
ul#nav li:hover li a,ul#nav li.over li a {
	color: #FFF;
   background-color: #adbcc9;
}
ul#nav li:hover ul,ul#nav li.over ul { display: block; } /* The magic */
/*.... code for top bar ............*/
#top-bar {
 position:fixed;
 top:0;
 left:0;
 z-index:999;
 width:100%;
 height:23px; 
}
* html #top-bar {
 position:absolute;
}
#topbar-inner {
 height:23px;
}
* html #topbar-inner { margin-right:16px;/* for scrollbar*/}
* html body{
 padding-top:23px;
}
* html, * html body{
 overflow-y: hidden; 
 height:100%;
 margin-top:-23px;
}
* html #mainouter {
 height:100%;
 width:100%;
 overflow:auto;
 position:relative;
 z-index:2;
}

</style>
</head>
<body>
<div id="top-bar"> 
  <div id="topbar-inner"> 
	<div id="ddwrap"> 
	  <ul id="nav">
		<li><a href="#">Home</a></li>
		<li class="ddwide"><a href="#">My Profile</a> 
		  <ul>
			<li><a href="#">Private Messages Inbox</a></li>
			<li><a href="#">View My Profile</a></li>
			<li><a href="#">Control Panel</a></li>
			<li><a href="#">Edit My Profile</a></li>
			<li><a href="#">Edit My Options</a></li>
			<li><a href="#">Edit My Signature</a></li>
			<li><a href="#">Edit My Avatar</a></li>
		  </ul>
		</li>
		<li><a href="#">News</a> 
		  <ul>
			<li><a href="#">Latest News</a></li>
			<li><a href="#">Industry News</a></li>
		  </ul>
		</li>
		<li><a href="#">Community</a> 
		  <ul>
			<li><a href="#">Forum</a></li>
			<li><a href="#">Todays Posts</a></li>
			<li><a href="#">Members Gallery</a></li>
			<li><a href="#">Who's Online</a></li>
			<li><a href="#">Archive</a></li>
		  </ul>
		</li>
		<li><a href="#">Articles</a> 
		  <ul>
			<li><a href="#">Article 1</a></li>
			<li><a href="#">Article 2</a></li>
			<li><a href="#">Industry</a></li>
		  </ul>
		</li>
		<li><a href="#">Reviews</a> 
		  <ul>
			<li><a href="#">Review 1</a></li>
			<li><a href="#">Review 2</a></li>
			<li><a href="#">Review 3</a></li>
			<li><a href="#">Review 4</a></li>
		  </ul>
		</li>
		<li class="ddwide"><a href="#">Calendar</a> 
		  <ul>
			<li><a href="#">Releases</a></li>
			<li><a href="#">Public/Events</a></li>
		  </ul>
		</li>
		<li><a href="#">Competitions</a> 
		  <ul>
			<li><a href="#">Competitions</a></li>
		  </ul>
		</li>
		<li><a href="#">Cool Stuff</a> 
		  <ul>
			<li><a href="#">Media Player</a></li>
			<li><a href="#">Arcade</a></li>
		  </ul>
		</li>
		<li><a href="#">Contact Us</a> 
		  <ul>
			<li><a href="#">Contact Us</a></li>
			<li><a href="#">Advertising</a></li>
			<li><a href="#">FAQ</a></li>
			<li><a href="#">Support Forum</a></li>
		  </ul>
		</li>
		<li class="ddsmall"><a href="#">Directory</a> 
		  <ul>
			<li><a href="#">Directory</a></li>
		  </ul>
		</li>
	  </ul>
	</div>
  </div>
</div>
<div id="mainouter"> 
  <p>some text to scroll</p>
  <p>some text to scroll</p>
  <p>some text to scroll</p>
  <p>some text to scroll</p>
  <p>some text to scroll</p>
  <p>some text to scroll</p>
  <p>some text to scroll</p>
  <p>some text to scroll</p>
  <p>some text to scroll</p>
  <p>some text to scroll</p>
  <p>some text to scroll</p>
  <p>some text to scroll</p>
  <p>some text to scroll</p>
  <p>some text to scroll</p>
  <p>some text to scroll</p>
  <p>some text to scroll</p>
  <p>some text to scroll</p>
  <p>some text to scroll</p>
  <p>some text to scroll</p>
  <p>some text to scroll</p>
  <p>some text to scroll</p>
  <p>some text to scroll</p>
  <p>some text to scroll</p>
  <p>some text to scroll</p>
  <p>some text to scroll</p>
  <p>some text to scroll</p>
  <p>some text to scroll</p>
  <p>some text to scroll</p>
  <p>some text to scroll</p>
  <p>some text to scroll</p>
  <p>some text to scroll</p>
  <p>some text to scroll</p>
  <p>some text to scroll</p>
  <p>some text to scroll</p>
  <p>some text to scroll</p>
  <p>some text to scroll</p>
  <p>some text to scroll</p>
  <p>some text to scroll</p>
  <p>some text to scroll</p>
  <p>some text to scroll</p>
  <p>some text to scroll</p>
  <p>some text to scroll</p>
  <p>some text to scroll</p>
  <p>some text to scroll</p>
  <p>some text to scroll</p>
  <p>some text to scroll</p>
  <p>some text to scroll</p>
  <p>some text to scroll</p>
  <p>some text to scroll</p>
</div>
</body>
</html>

I’m sure you can work it all out. It uses some proprietary ie code but you can put that in a separate file and call it with conditional comments if you want.

Hop its of some use.

Paul

Thanks for the reply. It’s good to know that I might be able to sort this out with php after all. It’s a shame that this layout can’t be done without quirks mode though. I like it but I’d rather it was running to standards.

The second example above is in standards mode. Its only if you need a page that always stays at 100% that you need quirks mode.

There may well be a solution in standards mode because I thought the second example wasn’t feasible but works out very well. I just never had the time to get back to it:)

Paul

If you figure out how to do the 100%-height version in standards mode, could you let me know? I’d really appreciate it.

Thanks a lot.

Hi Paul, I was wondering if you or any other interested party on here could help me out with a bit of a problem I am having with the footer on one page not being pushed to the bottom of the page. I can’t see what is wrong, and it is not a problem with IE beleive it or not, it is with Firefox. It is confusing… I can’t see the error, but it must be somewhere, considering all of the other pages are working propery. I have compared the problem one with working pages, but still can’t seem to see the glitch…
Here is the page (again it is only in Firefox that I see the error, not IE):

http://stanleyparkecology.ca/jobs/

Any other page that has a lot of content on it seems to work… it validates and as far as I can see all the divs are properly placed and closed…

Much thanks if you can help.
Cheers.

Hi,

Your error is here - Can you see it ?


#jobs {
 background:url(/images/design/bgJobs.jpg) 100% 0 no-repeat;
 min-height:422px;
}
html #jobs{
 height:auto;
 height:422px;
}

You missed the universal selector out so moz only gets a fixed height and will not expand.


#jobs {
 background:url(/images/design/bgJobs.jpg) 100% 0 no-repeat;
 min-height:422px;
}
[b]* html #jobs{
[/b] height:auto;
 height:422px;
}

:slight_smile:

Paul

ooops! Yes I see it thanks. I now remember removing it due to a validation error I was getting, but that was because of another dumb mistake in not putting a space between the universal selector and ‘html’… sigh…
Thanks agian.

Here you go:

http://www.pmob.co.uk/temp/fixedlayoutexample5.htm

enjoy :slight_smile:

Paul

Hey Paul,

Thanks a lot. That looks great.

I’ve just been trying to adapt it to my current page, but it’s been difficult. I had it looking OK in Firefox, but it was all screwy in IE. Then I realised I might need to copy the code you’d taken out and put onto the page there. I did that, but it was still a bit messed up.

Anyway, I have work to do now, so I kind of gave up for now (I’ll get back to it in a day or two).
Another problem I’m faced with here though - I wonder if you can help me with this one - is that on the page I have at the moment, I have a menu fixed on the left (http://cheers-sendai.com) - in any browser, it’s fixed there because the body doesn’t move and it’s set to position:absolute. I know how to do this, but I couldn’t seem to do it with your page.

I think the problem I’m having is that I don’t understand it completely, so I’m not exactly sure what I’m doing.

Anyway, I appreciate the thought and I will use your code when I have time and can figure it out.

Thanks again.

Hi,

If you want to add a fixed sidebar to my layout above you can do it like this:

http://www.pmob.co.uk/temp/fixedlayoutexample6.htm

I’m not sure if thats what you were asking exactly :slight_smile:

Paul

Update :

Paul,

I couldn’t leave it alone (http://cheers-sendai.com/newindex.php)… I think I kind of have it working, but there are a few noticeable problems (all in IE)… Firstly, when the page loads, the backgrounds load last, so the page looks bad for a short time. I wonder why…
Secondly, the top and bottom of my scrollbar get covered up.
Thirdly, as I said above, I’d like the menu on the left to stay where it is - ie. fixed. It’s OK in Firefox, but not IE. (I know position:fixed doesn’t work in IE, but it is possible to it without position:fixed…)

I hope you can help. Thanks for looking,

Cheers.

Hi,

I think my new layout above does all you want:

http://www.pmob.co.uk/temp/fixedlayoutexample6.htm

It has fixed top and bottom and a fixed side panel.

I haven’t had time to transport it to your page but I’ll get back to it tomorrow :wink:

Paul

Hey Paul,

I guess maybe I didn’t see your newest layout there when I posted - kind of cross-posted.
It does look like what I want - yes. Only trouble is, it took me ages to apply the other one to my page. Will I need to do it all again or is there a quick way to add the fixed menu?

Thanks again.

Hi,

Looks like the centering may be a problem but you can fix the side menu quite easily for ie6.


#tempmenu {
 display:block;
 width:130px;
 position:fixed;
 padding:10px;
 text-align:center;
 font-weight:bold;
 color:#000099;
 font-family:Georgia, serif;
 font-size: 14px;
 text-transform: uppercase;
 z-index:3;
   [b]top:100px;left:7%
}
* html #tempmenu {position:absolute;}
[/b]

Then move the html for the list to here.


<div id="outer"> 
		<ul id="tempmenu">
		<li><a href="#" onclick="MM_openBrWindow('culture.shtml','CULTURE','scrollbars=yes,toolbar=no,left=160,top=50')">Culture</a></li>
		<li><a href="#" onclick="MM_openBrWindow('grammar.shtml','GRAMMAR','scrollbars=yes,left=160,top=50')"  >Grammar</a> 
		</li>
		<li><a href="#" onclick="MM_openBrWindow('business.shtml','BUSINESS','scrollbars=yes,left=160,top=50')"  >Business</a> 
		</li>
		<li> <a href="#" onclick="MM_openBrWindow('karaoke.shtml','KARAOKE','scrollbars=yes,left=160,top=50')"  >Karaoke</a> 
		</li>
		<li> <a href="#" onclick="MM_openBrWindow('tte.shtml','TOEICTOEFL','scrollbars=yes,left=160,top=50')"  >TOEIC/TOEFL</a> 
		</li>
		<li><a href="#" onclick="MM_openBrWindow('tte.shtml','EIKEN','scrollbars=yes,left=160,top=50')"  >Eiken</a> 
		</li>
		<li><a href="#" onclick="MM_openBrWindow('writing.shtml','WRITING','scrollbars=yes,left=160,top=50')"  >Writing</a></li>
		<li><a href="#" onclick="MM_openBrWindow('coffeetalk.shtml','COFFEETALK','scrollbars=yes,left=160,top=50')"  >Coffee 
		  Talk</a></li>
		<li><a href="#" onclick="MM_openBrWindow('travel.shtml','TRAVEL','scrollbars=yes,left=160,top=50')"  >Travel</a></li>
		<li><a href="#" onclick="MM_openBrWindow('guitar.shtml','GUITAR','scrollbars=yes,left=160,top=50')"  >Guitar</a></li>
		<li><a href="#" onclick="MM_openBrWindow('kids.shtml','KIDS','scrollbars=yes,left=160,top=50')" >Kids</a></li>
		<li><a href="#" onclick="MM_openBrWindow('private.shtml','PRIVATE','scrollbars=yes,left=160,top=50')" >Private</a></li>
	  </ul>
<div id="contain-all"> 


Ie5 and 5.5. would need a bit of tweaking but could be done. I’m a bit short of time today otherwise I’d look into it for you :slight_smile:

Paul

Hi Paul,

Thanks again for all your help.

With a lot of tweaking, I think I’m there - it’s more or less exactly how I want it and now I’ll be able to do what I said I was going to do - use a php template so that the site looks more consistent.

Is there any chance of a good explanation of how it works some time in the future? (No hurry) I tried to do this so many times but couldn’t do it without relying on quirks mode.

So yeah… what can I say that hasn’t been said before? You are a css God. :cool:

(I only know this works in Firefox, IE6 and Opera by the way - I don’t have IE5 or a Mac)

Hi,

Well I tested my original demo in all these browers and it worked fine :slight_smile:

IE5 IE5.5. and ie6 - Firefox 1.0, Mozilla 1.3+, NN 6.2, Opera 6.03 7.2 7.5 and ie5.1 mac

However i haven’t had time to make layouts from it to check any problems but all seems ok.

How does it work ?

take a deep breath…

The usual way of making fixed positioning work in ie requires quirks mode and is to take the scroll mechanism away from the body (overflow:hidden) and apply it to a 100% pagewrapper element. This now becomes the root element.

We the set the top and bottom padding ( and sides if needed) on the original body element then place our header and footer there absolutely. They are now outside our new pagewrapper and thus become fixed in position. Quirks mode is needed because when 100% height is required (in the case of a footer) then the padding top and bottom on the body would mess standards mode up because it would add it to the 100%. In quirks mode padding does not affect the stated dimension and allows the layout to work.

Where my layout works is that it takes advantage of a bug (or behaviour - i’m not sure which) where children of elements that have a parent set with overflow:auto become position fixed when any positioning is added to them (either relative or absolute). This allows the footer to be set at the bottom of the window without increasing the padding on the body. Its very simple:) All the other fixes are for ie5 and 5.5. which must use the method that I described earlier.

heres a simle example to show how it works in ie:


<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "[http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd](http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd)">
<html xmlns="[http://www.w3.org/1999/xhtml](http://www.w3.org/1999/xhtml)">
<head>
<title>Untitled Document</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<style type="text/css">
#outer{
width:600px;
height:200px;
background:#ffffcc;
overflow:auto;
border:1px solid #000;
}
p#fixed{
position:relative;
left:200px;
top:25px;
background:yellow;
width:300px;
}
</style>
</head>
<body>
<div id="outer"> 
  <p id="fixed">Watching the content scroll by</p>
  <p>This is the content:</p>
  <p>This is the content:</p>
  <p>This is the content:</p>
  <p>This is the content:</p>
  <p>This is the content:</p>
  <p>This is the content:</p>
  <p>This is the content:</p>
  <p>This is the content:</p>
  <p>This is the content:</p>
  <p>This is the content:</p>
  <p>This is the content:</p>
  <p>This is the content:</p>
  <p>This is the content:</p>
  <p>This is the content:</p>
  <p>This is the content:</p>
  <p>This is the content:</p>
  <p>This is the content:</p>
  <p>This is the content:</p>
  <p>This is the content:</p>
  <p>This is the content:</p>
  <p>This is the content:</p>
  <p>This is the content:</p>
  <p>This is the content:</p>
  <p>This is the content:</p>
  <p>This is the content:</p>
  <p>This is the content:</p>
  <p>This is the content:</p>
  <p>This is the content:</p>
  <p>This is the content:</p>
  <p>This is the content:</p>
</div>
</body>
</html>

Hope that makes it a little clearer.

Paul

hi paul,
i’m trying to get to your 3-column-layout-examples but always get a timeout when visiting any of your pages on the server http://www.pmob.co.uk .
am i mad or is it your server that strikes =) ?
many greetings!
jule

Hi Jule,

The server seems to be working ok. I have been uploading and moving files around so maybe it locked you out for a while.

The three column demos can be found here.

http://www.pmob.co.uk/temp/3colfixedtest_4.htm

Paul

:fangel:
hi paul,
i don’t get it, but i still geht a timeout with firefox and ie… and i’m not connected to any server or router, just directly to my dsl.
maybe you could send me the example via email? would that be ok?
jule

I’ve sent you a PM :slight_smile: