Table grid with css
Posted: Mon Feb 02, 2009 8:41 pm
Hello Friends,
We always use table for grid at html pages. Recently I was working on a page where I needed a grid with three column and 5 rows.. where I had to use <ul>, <li> and <div> for designing...

I completed the project with the following way.. I hope it is OK and will help someone for this type solutions...
HTML page code
---------------------------------------------------------
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>Test grid design</title>
<style type="text/css">
<!--
@import url("main.css");
-->
</style>
</head>
<body>
<div id="left">
<ul id="pages">
<li>
<div class="divstyle">This is Div1</div>
<div class="divstyle">This is Div2</div>
<div class="divstyle">This is Div3</div>
</li>
<li>
<div class="divstyle">This is Div1</div>
<div class="divstyle">This is Div2</div>
<div class="divstyle">This is Div3</div>
</li>
<li>
<div class="divstyle">This is Div1</div>
<div class="divstyle">This is Div2</div>
<div class="divstyle">This is Div3</div>
</li>
<li>
<div class="divstyle">This is Div1</div>
<div class="divstyle">This is Div2</div>
<div class="divstyle">This is Div3</div>
</li>
<li>
<div class="divstyle">This is Div1</div>
<div class="divstyle">This is Div2</div>
<div class="divstyle">This is Div3</div>
</li>
</ul>
</div>
</body>
</html>
----------------------------------------------
CSS style code
-----------------------------------------------
#left{
width:460px;
}
#left #pages{
padding:0px;
margin:0px;
list-style:none;
}
#left #pages li{
padding:0;
margin:0;
text-align:left;
margin-bottom:1px;
}
#left #pages div{
float:left;
width:140px;
padding:0 5px;
border:1px solid #cccccc;
height:25px;
line-height:25px;
background-color:#f5f5f5;
color:#000000;
text-decoration:none;
}
---------------------------------------
I just sharing my knowledge and findings, though I know many of you completed this type solution before.
Thanks
We always use table for grid at html pages. Recently I was working on a page where I needed a grid with three column and 5 rows.. where I had to use <ul>, <li> and <div> for designing...

I completed the project with the following way.. I hope it is OK and will help someone for this type solutions...
HTML page code
---------------------------------------------------------
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>Test grid design</title>
<style type="text/css">
<!--
@import url("main.css");
-->
</style>
</head>
<body>
<div id="left">
<ul id="pages">
<li>
<div class="divstyle">This is Div1</div>
<div class="divstyle">This is Div2</div>
<div class="divstyle">This is Div3</div>
</li>
<li>
<div class="divstyle">This is Div1</div>
<div class="divstyle">This is Div2</div>
<div class="divstyle">This is Div3</div>
</li>
<li>
<div class="divstyle">This is Div1</div>
<div class="divstyle">This is Div2</div>
<div class="divstyle">This is Div3</div>
</li>
<li>
<div class="divstyle">This is Div1</div>
<div class="divstyle">This is Div2</div>
<div class="divstyle">This is Div3</div>
</li>
<li>
<div class="divstyle">This is Div1</div>
<div class="divstyle">This is Div2</div>
<div class="divstyle">This is Div3</div>
</li>
</ul>
</div>
</body>
</html>
----------------------------------------------
CSS style code
-----------------------------------------------
#left{
width:460px;
}
#left #pages{
padding:0px;
margin:0px;
list-style:none;
}
#left #pages li{
padding:0;
margin:0;
text-align:left;
margin-bottom:1px;
}
#left #pages div{
float:left;
width:140px;
padding:0 5px;
border:1px solid #cccccc;
height:25px;
line-height:25px;
background-color:#f5f5f5;
color:#000000;
text-decoration:none;
}
---------------------------------------
I just sharing my knowledge and findings, though I know many of you completed this type solution before.
Thanks