Reputation: 15598
I have been trying to get yui-css grid system to make a three column grid, where the first on (left) uses 1/4 of the space, the second (middle) uses 2/4 of the space and the third (right) uses 1/4 of the space.
Something like this:
| header |
-------- ------------------------
| left | middle | right |
--------------------------------
| footer |
Any input will be much appreciated.
UPDATE: Judging from the answers/comments, I realize some more info is needed.
Upvotes: 1
Views: 577
Reputation: 960
using yui solution is quite tricky :) but below is ur solution to 1/4, 2/4, 1/4 column layout
<body>
<div id="doc4" class="yui-t5">
<div id="hd">
</div> <!-- header -->
<div id="bd">
<div id="yui-main">
<div class="yui-b">
<div class="yui-gd">
<div class="yui-u first">
Left Column
</div> <!-- yui-u first -->
<div class="yui-u">
Middle Column
</div> <!-- yui-u -->
</div> <!-- yui-gd -->
</div> <!-- yui-b -->
</div> <!-- yui-main -->
<div class="yui-b">
Right Column
</div> <!-- yui-b -->
</div> <!-- body -->
</div> <!-- doc4 -->
</body>
Upvotes: 2
Reputation: 253318
Using general CSS/(X)HTML:
<?xml version="1.0" encoding="utf-8"?>
<!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" xml:lang="en" lang="en">
<head>
<title></title>
<link rel="stylesheet" type="text/css" href="css/stylesheet.css" />
<style type="text/css" media="all">
#wrapper {width: 100%; position: relative; }
#header {width: 100%;text-align: center; }
#left-col {width: 24%; display: inline-block;}
#main-col {width: 48%; margin: 0 1%; display: inline-block;}
#right-col {width: 24%; display: inline-block;}
#footer {width: 100%; clear: both; text-align: center; }
</style>
</head>
<body>
<div id="wrapper">
<div id="header">
<h1>...header-content...</h1>
</div>
<div id="left-col">
...left-col content...
</div>
<div id="main-col">
...main-col content...
</div>
<div id="right-col">
...right-col content...
</div>
<div id="footer">
...footer content...
</div>
</div>
</body>
</html>
<div id="wrapper">
<div id="header">
...content...
</div>
<div id="left-col">
...content...
</div>
<div id="main-col">
...content...
</div>
<div id="right-col">
...content...
</div>
</div>
This works, but it isn't particularly pretty, and you're still left to deal with the column heights and locations yourself.
Upvotes: 1
Reputation: 86216
I've used yui's grid for fixed formats, but for resizable liquid layouts I prefer this solution. It sounds like you want to use percentages rather than a set number of pixels. Is there a reason you're using yui grid for this?
Upvotes: 1