Footer won't push down with contents

Hi Folks,

I have been designing the layout for a local history site and I thought I would try using div tags and pure css to create the site instead of the usual tables.

I tried to design it with different screen resolutions in mind and used includes to bring in the header and footer in to join the body of the page, this seemed to be going ok, I had everything in the right place and the resolution was changing when I maximised and minimised it.

If I insert an image into the contents that fits in between my header and footer as long as it is below 800x600 everything is ok (my monitor is 1280x1024) 800px high is what is left when I take the header and footer off, you can see this at acumfaegovan Main Page

CSS can be found here Common CSS and here [URL=“http://www.acumfaegovan.com/style/headfoot.css”]Header and footer CSS

However when I add an image and content that is greater than 800px high it goes behind my footer and I could not see it I added overflow:scroll and it lets me scroll down to the content but the footer does not push down with the contents and seems fixed to my screen resolution.

Is there a way I keep the footer pushing down as I scroll down the contents? how can I do this without losing fluidity?

You can see the problem the of content and footer here acumfaegovan Main Page

CSS can be found here Common CSS and here [URL=“http://www.acumfaegovan.com/style/headfoot_new.css”]Header and footer CSS

Please help, I have put a lot of hours into this and I do not want to give up and go back to tables.

Colin

This has been coming up almost twice a week now – is there some book or online tutorial people are getting this completely broken site-building methodology from or something?!?

The problem is your entire site is built using “position:absolute” instead of flow. With position:absolute stripping all elements from flow, there is nothing left to push things like your footer down.

APO - “absolute positioning” should be reserved for small inside flow elements – it should never be applied to massive slabs of content as you have done here.

In general, given now simple this layout is you’ve got way too many DIV, zero images off graceful degradation, and the tranny doctype indicates you are in transition from 1997 to 1998 – not exactly up to date site building methodologies. The IE conditional comment bloat nonsense for building the menu is also a contributing factor to an unnecessarily complex page.

If I was writing that exact same page, the markup would probably go something like this:


<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html
	xmlns="http://www.w3.org/1999/xhtml"
	lang="en"
	xml:lang="en"
><head>

<meta
	http-equiv="Content-Type"
	content="text/html; charset=utf-8"
/>

<meta
	http-equiv="Content-Language"
	content="en"
/>

<link
	type="text/css"
	rel="stylesheet"
	href="screen.css"
	media="screen,projection,tv"
/>

<title>
	acumfaegovan Main Page
</title>

</head><body>

<div id="pageWrapper">

	<h1>
		<span>
			acumfaegovan
			<small>GOVAN - THE PLACE and THE PEOPLE</small>
			<span><!-- image replacement --></span>
		</span>
	</h1>

	<ul id="mainMenu">
		<li>
			<a href="index.php">HOME</a>
		</li><li>
			<a href="govan.php">GOVAN</a>
			<ul>
				<li>
					<a href="history.php">Govan's History ></a>
					<ul>
						<li><a href="earlyhistory.php">Early History</a></li>
						<li><a href="wts.php">Village to Burgh</a></li>
						<li><a href="recenthistory.php">Recent History</a></li>
					</ul>
				</li>
				<li><a href="govanbuilt.php">Govan Built</a></li>
				<li><a href="govaninprint.php">Govan in Print</a></li>
			</ul>
		</li><li>
			<a href="govanites.php">GOVANITES</a>
			<ul>
				<li><a href="notablepeole.php">Notable People</a></li>
				<li><a href="govanitespast.php">Past Govanites</a></li>
				<li><a href="peoplesstories.php">People's Stories</a></li>
			</ul>
		</li><li>
			<a href="govaninpics.php">GOVAN in PICS</a>
			<ul>
				<li><a href="postcards.php" title="Old Govan Postcards">Govan Postcards</a></li>
				<li><a href="govanofold.php" title="Pics of Govan of Old">Govan of Old</a></li>
				<li><a href="thenandnow.php" title="Then and Now Pics">Then and Now</a></li>
				<li><a href="recentpics.php" title="More Recent Pics of Govan">Recent Pics</a></li>
				<li><a href="peoplepics.php" title="Pics of Govan People">People Pics</a></li>
				<li><a href="govanonfilm.php" title="Video Footage of Govan">Govan on Film</a></li>
			</ul>
		</li><li>
			<a href="community.php">COMMUNITY</a>
			<ul>
				<li><a href="communitynews.php">Community News</a></li>
				<li><a href="communityevents.php">Community Events</a></li>
				<li><a href="communitygroups.php">Community Groups</a></li>
			</ul>
		</li><li>
			<a href="http://forum.acumfaegovan.com">FORUM</a>
			<ul>
				<li><a href="http://forum.acumfaegovan.com/ucp.php?mode=register">Register</a></li>
				<li><a href="http://forum.acumfaegovan.com">Browse Forums</a></li>
			</ul>
		</li><li>
			<a href="opacity/index.html">ABOUT US</a>
			<ul>
				<li><a href="aboutus.php" title="About acumfaegovan">About Us</a></li>
				<li><a href="contact.php" title="About acumfaegovan">Contact Us</a></li>
			</ul>
		</li>
	</ul>

	<div id="content">
		<img
			src="http://www.sitepoint.com/forums/images/govancollage2.jpg"
			alt="A collage of Govan's History"
			class="plate"
		/>
	<!-- #content --></div>

	<div id="footer">
		<form id="search" action="http://www.google.com/cse" method="post">
			<fieldset>
				<input id="search_field" name="q" type="text" value="Search acumfaegovan" />
				<input type="image" name="submit_button" id="submit_button" src="style/images/google.gif" />
				<input type="hidden" name="cx" value="005992542237703518527:ft-1p1cr0bg" />
			</fieldset>
		</form>
		Site last updated on the 26th July 2011
	<!-- #footer --></div>

<!-- #pageWrapper --></div>

</body></html>

I’ve got to help someone else out first, but I’ll try to revisit this later tonight to belt out the CSS to go with that markup.

Hi Colin. Welcome to SitePoint. :slight_smile:

As deathshadow60 (Jason) said, absolute positioning for web layout makes life very difficult, as elements are pretty much unaware of each other and thus don’t play nicely together. You are lucky to have Jason working for you, as he is amazingly generous with his posts, so stay tuned!

Thanks Jason,

I realy appreciate your expertise,

As you probably guess I am new to using div and css for layout, however every one was recomending it be used saying tables were old hat, and on further research it indeed did seem a whole lot better option for many reasons.

I have got some of it but have struggled with the whole absolute and relative thing and have scrapped it all and started again may times. (this lack of understanding of absolute and relative as you have pointed out has been my downfall)

It has been quite a learning curve and I realy appreciate the help, I will again go back to the drawing board and scrap it, this time I will use your XHTML code as a guide.

Thanks again

Colin

Hi Ralph,

Thanks for the welcome, yep Jason certainly looks as though he knows his stuff.

He certainly does. This is a great place to learn, so please feel free to ask lots of questions—even the most basic ones (those are fun!) If you experiment with elements step by step you’ll learn very quickly, and you can post simple scenarios here and ask what would be the best way to code them. :slight_smile:

Sorry for the delay – real life got in the way. Here’s what I came up with:
http://www.cutcodedown.com/for_others/quigs1969/template.html

As with all my examples the directory:

http://www.cutcodedown.com/for_others/quigs1969

Is unlocked for easy access. Valid XHTML 1.0 Strict, would be valid CSS 2.1 if not for a few IE specific workarounds, tested working all the way back to IE 5.5.

The markup did get some slight additions and re-arrangements. I put it in a min-height layout so the footer will remain ‘stuck’ at the bottom without overlapping content, and a whole slew of dummy span were added to the H1 to deal with the multiple images in the header.

To explain the HTML:

Everything in the HEAD shouldn’t take too much explanation – in the body #pageWrapper is a stock container I put in all layouts – in this case it will be used to make the min-height part of the layout. The H1 is the first heading on the page – by definition all other headings on the page are subsections of the h1, which is why the site title area is the most likely candidate to be the one and only. (much like Cyrus. They say he’s the one and only… can you dig it?). The clustered/nested spans are there for all those separate images and effects you have that are strictly presentational. The text and small tag are present so that images off users will still get the text for the heading… the final empty span “sandbag” gets placed over the h1 with the main logo image
erasing the text. Layering the same size elements with different background positions one atop the other is basically the “painters algorythm”; back to front you put pieces atop each-other to add/remove them from view.

The main menu gets a flat unordered list. I got rid of the titles because they really weren’t adding anything useful to the anchors – there are only two legitimate reasons to put TITLE on an element – if it’s an anchor you’re assigning accesskeys to for Opera/Blazer and a couple other handheld browsers, or if content of the anchor does not convey sufficient meaning. The latter of those, if the anchor content isn’t displaying enough meaning, there’s probably something horribly wrong with that content. There is NO legitimate reason other than accesskeys for putting title attributes on anchors that’s identical to the content of the anchor – other than to waste bandwidth.

The Content DIV is nothing fancy…

The new version closes pagewrapper at this point so that the footer appears AFTER the min-height. This allows me to ride the footer up over the content in the CSS for the total desired height. The form inside it gets a fieldset since you have semantics (thankfully LEGEND is optional in XHTML), and there’s not enough text in there to warrant the use of a paragraph IMHO.

I’ve got to head out the door for a bit, but when I get back I’ll write up a section by section breakdown of the CSS to explain where the real magic is going on.

Thanks guys,

I scrapped it and used a trial version of the Flexi CSS Layouts plugin, it seems ok now although there seems a lot of code and the seem to have split up div attributes between layout and design. You can see it here I think it is a lot more fluid now, see here Page built with Flexi CSS Layouts

This page wrapper has min-height of 950px, which leaves 700px for body/content, good for the example page above which has one image 800x600. If I want content greater than this I will have to increase wrapper min-height +950px and adjust the body/content height appropriatly.

There is not one absolute or relative position in this design?

Wow, Jason I just seen your post after I posted the last post, the code you have written is ecellent very very streamlined, I can see why your site is called cutcodedown.com.

The menu bar is fluid now could not acomplish that, I am gobsmacked how you could write that all so quickly.

It is exactly the desired effect I was wanting.

I can not thank you enough Jason, The Flexi CSS Layouts monster of an example is cerainly going in the recycle bin.

Just having a closer look look at the code, where did all the div tags go, lol.

You amazingly only used 3 div tags, the Flexi CSS Layout used 70+, go figure!!

CSS frameworks are trash, avoid at all costs. The entire concept has been flawed from the beginning. Clever, perhaps convoluted, bloated and completely unnecessary – yep.

Hi Jason

I tested it out on Safari, Opera, Firefox and IE5 to IE7 and it works great, however in IE8 to IE10 the header is not pushing all the way up to the top of the browser leaving a gap of about 15px. I guess it is a margin or padding property that IE8+ is not prcessing, I will try to tweak it.

What are the alternatives, are the as flexible, are you saying tables should be used for layout instead?

Can’t say I’ve heard of flexi, but universally CSS frameworks – and web frameworks in general are as disastrously bloated rubbish as using the WYSIWYG parts of tools like Dreamweaver or frontpage.

They use all sorts of extra wrapping element, and even more presentational and/or vague/meaningless classes – to the point they defeat one of the reasons to even USE CSS in the first place; separation of presentation from content.

I think everyone could benefit from this – let’s review the two biggest advantages of CSS.

  1. You can remove presentation from your HTML making for simpler HTML. Saying what things are, NOT what they look like. That’s the ENTIRE POINT of HTML in the first place, is to allow you to target multiple devices and NOT to have ANY default appearance on the content – so user agents (browsers) can customize the output to the capabilities of what it’s being displayed on.

This means you can target MULTIPLE different device capabilities (screen, handheld, print, screen at narrow width, etc) with wildly different appearances without changing the HTML. It also means in an ideal circumstance the ability to totally reskin the site without touching the HTML; a massive boon for things like forum software.

  1. CSS in an external file is cached across pages, so the more stuff you can move out of the HTML and into the CSS that is used on every page on a site, the less bandwidth you use and the faster those sub-pages will load. By consolidating to a single file, you can even pre-cache styling for pages the user hasn’t even visited yet – speeding up the load of sub-pages even if there is a slight penalty on first-load… This means if you get a lot of visitors who actually go to more than one page, they’ll have a faster/better experience… While if you have a site that’s nothing but bounces… well, you’re pretty well boned either way then :smiley:

These are concepts that CSS frameworks and WYSIWYG editors both soak in gasoline, light on fire and then piss on the ashes. The use of presentational classes in the markup and extra containers when they probably aren’t needed amounts to not just bloat, but for all intents and purposes the exact same type of nonsense HTML Strict was supposed to make us all stop doing. As I say WAY too often, by the time you use a CSS framework or nonsense like OOCSS, you might as well go back to writing HTML 3.2 circa the late 90’s for all the “improvement” they offer.

The REAL idiocy being that you have to learn JUST as much to use these dumbass frameworks as you would to just learn to write it properly in the first place – they are more code, more complex code, and in general more effort than just writing plain jane CSS without them!

Especially once the long term costs of maintaining those disasters is figured into the equation. As I learned decades ago about programming, “The less code you use, the less there is to break!”

Ok, enough ranting from the soapbox… I’m going to start writing the CSS explanation now – probably take me longer to explain it than it did to write it.

My bad, the Opera fix was messing up IE7 for some reason, so I tried changing it – which messed up IE8+ on the copy you saw.

Whack-a-mole. New CSS uploaded to fix that (give it a a couple refreshes). It’s actually why you’ll hear so many people *****ing about legacy IE versions – you fix one and another messes up… it all could be so much simpler if IE never existed, but it’s still over a billion people using it, and even at the alleged “2%” for IE6 that’s still 40 million people. (funny since the stats for my own sites report >20% still) – so it’s still worth the little bit of extra effort to get them in there.

ok, on to the CSS.

The first thing I put in EVERY CSS file I work with is a reset. Not all browsers start out with the same paddings or margins on everything, or even the same borders. A lot of people argue against the use of resets, but I find them to use less code overall and in general prevent a lot of cross browser headaches. There are smaller resets, like the so called “universal” reset using the * selector, but it tends to mess up form elements. There are larger ones, like Eric Meyer’s “Reset Reloaded” – but that fat bloated pig borders on being a CSS framework in scope, and on the whole is responsible for why “CSS resets” get a bad rap in some circles.

html, body – After the margin/padding/border resets comes setting a fixed 100% height on HTML and BODY. In CSS elements cannot accept height unless their parent has a height declared on it (or positioning). Setting 100% height on both these parent elements lets us set 100% min-height on our pageWrapper. Opera sometimes screws up redrawing this or even calculating it – adding position:relative clears up that little issue nicely.

body – I set up a default font size in percentages. Where possible your “content” area on the page should use dynamic fonts (%/em) and not fixed fonts (px). PX is often the only solution to certain layouts, but if you have to go PX for your content area, you should rethink the design instead. 85% gives 14px to 96dpi/Small font users, and 17px to large font/120dpi users – a nice comfortable font size for both.

When declaring my body font, I ALWAYS declare a line-height – and by the time you declare font-size, line-height and font-family, you might as well use the condensed font declaration. WHENEVER you change the font size, I HIGHLY recommend setting the line-height again as you CANNOT trust it to inherit… This is why whenever I change the font, I just use the full property.

The background setting gives us that grey for the content, and the left border image. I actually put both sides of the border into a single file 2560 wide and 1px tall. It is VERY unlikely anyone would view it wider than that, and by using a ‘play’ on sliding-doors (combined with #pageWrapper) we can use one really small .png instead of the two separate .gif you had.

More files is bad – there’s this thing called “handshaking”, the communication between the browser and the server to request files. The less times you go to the server, the faster a page can load. It’s where image-recombination and image-sprites can really come in handy.

* html body – this declaration loads a behavior file, csshover3.htc. Behavior files are IE specific javascripts you can load from your CSS. A lot of people won’t use them because some broken ass servers don’t send it with the right mime-type breaking how they work. I refuse to not use something just because some nimrod is too much of a {expletive omitted} to configure their servers properly… especially since on REAL servers said mime-type issue can be circumvented via .htaccess.

The file in question is called “Whatever:hover” from PeterNed’s website. Horrible website, but bloody useful little script.
Whatever:hover

The main point of that file, it makes the menu work by letting IE6 and lower do :hover on any element.

You may not have seen “* html” before. It’s a hack – it’s an ugly hack, that says “all html tags that have a parent” – HTML can’t have a parent element, but IE6 and lower incorrectly thinks it does. The selector grouping itself IS valid CSS, it just shouldn’t target anything. It’s a quick and easy way to say “IE6 and lower” without bloating out the markup with an extra stylesheet include stuffed inside a conditional comment.

body:before – this is bugfix for opera. When resizing min-height layouts Opera doesn’t like to do it unless there’s a 100% height child-element directly off body. The :before psuedo-element and content attribute are what’s called “generated content” – CSS making it’s own elements. This is a VERY powerful tool, but support across browsers limits it’s utility. In this case we’re really only using it for Opera so all the compatibility stuff doesn’t matter. Giving it a a float and MASSIVE negative top margin hides it from interfering with other browsers.

#pageWrapper – I give this a min-width since the layout falls apart below that anyways… That’s a 800 friendly min-width anyhow – anything below that should proably be getting a handheld/mobile stylesheeet all it’s own…

The min-height declaration is where the magic happens. This means that if the content is taller than screen height, we get that height on #pageWrapper. If the content isn’t that tall, #pageWrapper is the same height as the screen.

Finally the background – this just puts the right side border in place.

* html #pageWrapper – The comment says it all… IE6 and lower have no min-height, but for some weird reason treat height like it was min-height… so we just need to set height for IE6 and lower. Again “* html” makes this easy.

h1 – as there should only ever be ONE H1 on a page, and that all other headings for subsections of the page should be considered subsections of that H1, usually the only sane candidate is your site heading/title/logo/etc.

The height:1% fixes an odd bug in IE8 where it kinda behaves like Opera does. A lot of people were using a fix similar to the opera one, but I discovered that if you set a small percentage height on a child element of the min-heighted element (#pagewrapper) it fixes IE8’s behavior. Oddly this is NOT the usual reason height:1% is used – which is for a thing called “haslayout”. (We’ll get to that one in a bit).

The relative positioning allows us to absolute position an element inside this, with top/left 0:0 being the top left corner of the H1 instead of the page.

The text-align is nothing fancy, and the font declaration gives a similar appearance to images off users as your image version does. Load up the page in Opera (or firefox with the web developer toolbar installed) and disabled images to see what I mean.

Finally the background gets the color we want and the top gradient. The gradients I also combined into a 5120x32 file. Despite the massive resolution of that file, it still ends up under 1k as a png – PNG is BRUTALLY EFFECTIVE at compressing image files that have long horizontal runs of the same color. The left half of the image is the top gradient, the right half is the bottom one… “top left” therin shows the part we want at the top – again one file instead of two.

h1 small – small is an inline-level tag, and we want that subtext on it’s own line… so we set it to display:block for that behavior, then I just set the text size as desired.

h1 span – spans are also inline-level, so they to are set to block so they have height and can accept padding. The outermost span gets the bottom part of the gradient.

h1 span span – the next span in the h1 then gets the right logo. Rather than play with positioning or floats, your layout makes it pretty easy to just add a span, and use background-position to move it where we want. The auto-centering also means no headaches in terms of figuring out the math.

h1 span span span – the innermost wrapping span is of course the image for the opposite side. The padding is applied so that we have our total desired height around the text. We have one line of 60px line-height, one line of 28px line-height (small) and 32px padding, which gives us a total height of 152px which looks ok. Since all the backgrounds are positioned automatically, you can increase/decrease the height by changing the padding easily without touching anything else.

h1 span span span span – the fourth span is an empty (except for a comment) sandbag. I absolute position this over the text inside it – then call the actual logo image. Net result? it hides the text that’s in there for screen readers/search engines/images off/non-css users for your pretty image instead.

Because the text is in flow, we have a height to push the menu where it needs to be – which is where APO does the job nicely. This is what absolute positioning is for… to be an element placed inside/over something that has either a fixed height, or other content that makes it have height.

#mainMenu – list-style turns off bullets, the position:relative makes it depth sort over any position:relative elements before it… text-align is how the centering is done…

Then there’s the negative margin which will take a bit of explaining. I like to describe elements on a page as having two separate but related boxes – the ‘flow box’ which says where it is and how big it is in ‘flow’ – how the page is laid out. Then there’s the render box, which says how large it is when it’s drawn. Absolute positioning and floats remove items from ‘flow’ – margins on the other hand change the size of the flow box… so a negative top margin makes the element ‘shorter’ in flow, while the render box stays the same – bottom line? It rides it up OVER the h1 into the desired position.

It’s not a technically accurate description, but it works.

It oversimplifies and it ain’t quite right, but for purposes here it will have to do, 'cause I ain’t got the time to explain it to you… – MC Hawking

I violate one of my basic rules by using PX fonts. With the interaction to the H1 background and the images it loads on itself, PX is the only way to accurately predict it’s behavior across systems. When I’m forced to use PX, I consider 12px the smallest acceptable size, and really I get squirrelly over anything smaller than 14px.

#mainMenu li – the relative positioning allows us to position the nested UL dropdowns. The inline-block behavior lets them have width and height and positioning… then we have TWO hacks.

First up is the !ie hack. Legacy versions of IE (prior to IE8) either don’t have or screw up inline-block on block-level tags. (like LI)… but incorrectly treat display:inline as that. !IE is a hack that doesn’t work in newer versions of IE, but works in all the versions we need to fix that for. I don’t like resorting to that particular hack as it’s invalid CSS, but it’s the cleanest solution to the problem.

You can read up on selector hacks here:
CSS Hacks

Then there’s zoom:1; – the zoom property is also invalid CSS as it’s IE specific. Given all the browser specific nonsense people are doing with CSS3, I no longer feel guilt about using it to trip ‘haslayout’ – which is why it’s here.

Legacy (and sometimes modern) versions of IE often screw up on positioning elements and sometimes even rendering them. This all stems from a shortcut they made to try and make IE faster than Netscape. While it worked for that, it made CSS 2 a bit painful at times (though to be fair, IE5 was the first to even TRY to implement CSS2 in a real world deployable manner). Setting this makes the dropdowns behave in IE.

You can read up on haslayout here:
On having layout

#mainMenu a – the top level anchors get inline-block set on them so we can set top/bottom padding. Again I avoid setting heights since I don’t need to… 16px line-height + 6 px top padding + 2px bottom padding == that 24 px we wanted.

Rest of it’s just fonts, colors and images – the main-menu.png I made also has both states in it… hovered and unhovered. This pre-caches the hover state, and again uses one file instead of two.

#mainMenu li:hover a – since we want it to stay lit up when you’re in the submenu, we need to hover off the LI, hence the htc file up above. When you add border the size changes, so I decrease the padding by the border size to account for this. Rest of it is fonts, colors, border, and sliding the background-position to reveal the hover state part of the background image.

#mainMenu ul – the nested lists also get stripped of bullets, and are absolute positioned. I start them out positioned off screen using a massive negative left position. We have to fix the height for proper legacy IE behavior… the negative left margin slides it over half it’s width, which we’ll make use of in the hover state. The display:inline is there so that when we show it we can set display:block – sometimes IE7 and IE8 will refuse to render a change in position unless you change the display state, positioning type, or overflow. I use the display state for that fix. Without it, IE7 doesn’t like to hover, and when it does, it tends to not unhover.

#mainMenu ul li – if you don’t set these to block, IE7 and 8 will fail to let the block anchors will the width. Since this is safe to send to all modern browsers we set it first.

* html #mainMenu ul li – but, that screws up IE6, so we have to set it back to inline for those.

#mainMenu li:hover li a – we have to say the :hover for what’s called ‘specificity’ reasons. Some browsers will ignore the declaration without it, failing to override any values we set on “#mainMenu li:hover a”

Block, padding, no background, no border (unsetting the border set by the above hover).

#mainMenu li:hover ul – as mentioned, we change the display state straightening out IE 7/8’s behavior on them, and I move them over to “left:50%” – halfway across the parent element. Remember that 80px negative margin? Add them together and they’re centered.

#mainMenu li:hover li ul – the next menu in though we don’t want showing, so we have to hide it.

#mainMenu li li:hover ul – until we hover the correct element, which is when we show it. Different positioning, but same idea.

#mainMenu li li:hover a AND
#mainMenu li li li a:hover – just colors for the nested menu states.

Wow, that’s it for the menu.

Content – the top padding of 1EM is to match the bottom padding I usually put on paragraphs and other elements. The side padding is to push it in from the side borders we have on body and #pageWrapper, and the bottom padding makes ‘room’ for the footer. That bottom padding should be the same height as your footer in a min-height layout.

Content p – I set up paragraphs even though you don’t have them yet. I use 1em because it’s most always attractive and adjusts to the font size – I use padding instead of margins so I don’t have to even worry about margin collapse, and I set bottom padding only since there is no collapse.

.plate – The print term for a image in a document is a ‘plate’ – stemming from the large metal plates that were used in fixed typesetting. I usually have three classes set up… “.plate” for centered images, “leadingPlate” for images text is supposed to wrap around (float:left; margin:0 1em 1em 0;) and “trailingPlate” for images text is supposed to wrap around the other way (float:right; margin:0 0 1em 1em;) – I call them this instead of ‘left’ and ‘right’ because I might not be displaying them that way on all targets (like say handheld) if at all (like say… print).

#footer – More magic goes on here. To do a min-height layout the height of your footer MUST remain fixed, and with firefox being a total dip about how %/EM adds up or even means unable to calculate it the same way twice in a row, we’re stuck back on PX fonts. Position:relative, fix the height, and then use a negative margin to ride it up over Content’s bottom padding… since we ride it up over #pageWrapper we end up at it’s 100% min-height for the whole document… from there it’s just colors and the top gradient.

#search – I pad the top and bottom just to align it where it looks good.

#search input – vertical-align makes sure the search input and the submit image line up with each-other.

#search_field – width, and since input doesn’t inherit fonts, set the font size so the min-height layout doesn’t break on large font machines.

… and that’s the whole beast in a nutshell.

Jason: the Dr. House of SitePoint. :slight_smile: That’s a compliment, by the way.

Hi Jason,

Sorry taking so long to get back to you, I was away at a funeral.

Great job on the explanation too, very comprehensive.

No I can get on with adding the all important content.

Thanks again Jason your a true CSS whizz:)

Off Topic:

It’s not lupus. It’s never lupus.

lol

I don’t know how you interpreted what I said as that, but no, not at all. Tables should be used for tabular data and that is all. DIVs should not be used in place of tables. DIVs should be used as necessary (key word here is necessary) to separate and organize content on the page. Elements such as; p, ul, ol, dl, headings, etc will be used to mark-up content in place of wrapping everything in a div – just as bad as using tables for layout.