# Unholy Grail Layout (Reverse Holy Grail Layout)

The Holy Grail Layout in CSS, is a full height, 3 column layout which consists of a fluid central column, and two side columns with fixed widths.

Reverse it, make a fixed width central column, and two fluid width columns to the sides. The point is for them to take All available space both vertically and horizontally. So if one adds elements above, or elements below (assume 100% width), your solution should shrink to accommodate. Same goes with elements on the sides. Your layout should fill 100% of its container's space.

## Restrictions

• HTML and CSS only (no JavaScript)
• IE8+ support mandatory
• Must work in all major browsers (it is, after all, a layout!)
• HTML and CSS must both be valid.
• No tables, it's supposed to be a layout, not an abomination.

## Winner

• Code with fewest characters wins, excess spaces and newlines do not count, don't be afraid to be readable! (I'm running the solution through a minifier)

Good luck!

• The specification is a bit vague, but on the assumption that it can be tightened up, how would you pick a winner between two solutions? All questions on this site should have an objective primary winning criterion. – Peter Taylor Sep 7 '13 at 22:06
• Well, with the lack of a better criterion, I'd say it would be shortest code possible. I'll edit it as soon as I get to a PC. – Madara Uchiha Sep 8 '13 at 4:31
• How about providing a list of browsers to support, then score by the following? [code size] / [number of actually supported browsers] – Hand-E-Food Sep 8 '13 at 22:15
• I think the current attempt at an answer validates my comment that the specification is a bit vague. Can you give a precise definition of what counts as a "column"? – Peter Taylor Sep 9 '13 at 8:46
• @PeterTaylor As always: Proof by example. I don't know yet if this is counter productive or not. – Johannes Kuhn Sep 9 '13 at 8:53

Simple

<div style=float:left;>L</div><div style=float:right;>R</div><div style="width: 100px;margin:0px auto;">C</div>

• Who said that it needs to be valid html?
• Who said that I need a doctype?

Guaranteed to work in all browsers - old and new:

<table>
<tr>
<td>a</td>
<td class="f">b</td>
<td>c</td>
</tr>
</table>


CSS:

table, tr{
width: 100%;
}
.f{
width:100px;
}


Here's a fiddle: http://jsfiddle.net/8QWBX/1/

Note: if you want to make it shorter (but fail HTML standards) you may remove the tr tag and its styling. This will save 12 characters the way I see it.

• Table for layout? I feel ill. – Gareth Sep 9 '13 at 13:10

display:table-cell is compatible ie8+ (as seen in caniuse)

<!DOCTYPE html>
<title>a</title>
<style>
html { height: 100%}
body { margin: 0; display: table; height: 100%; width: 100%}
.c { display: table-cell }
.c2 { width: 6em }
</style>

The issue I see is when you want to put something above/below, you have to make them display: table-row, and probably specify a height.