Click to See Complete Forum and Search --> : Replace TABLE to DIV


imperial
06-05-2006, 01:31 AM
Hi,
Spoonfeed me please, you see my site uses a lot of tables(they say its bad use instead the div thing) and so it gives me the crap for their are tons of them on every pages, its quite a basic problem(I'm actually in a hurry so I let you guys do the hardship :( ) .

I got this code:
<table>
<tr>
<td>hello </td>
<td>hello </td>
<td>hello </td>
</tr>
<tr>
<td colspan="3">hello </td>
</tr>
</table>

but this is not the equivalent :)

<div>
<ul>
<li>hello </li>
<li>hello </li>
<li>hello </li>
</ul>
<ul>
<li colspan="3">hello </li>
</ul>
</div>

hope you could help, thanks!

NogDog
06-05-2006, 02:30 AM
You need to add CSS to your HTML, for example:

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html lang='en'>
<head>
<meta http-equiv='Content-Type' content='text/html; charset=ISO-8859-1'>
<title>Page Title</title>
<style type="text/css">
#test ul {
list-style: none;
margin: 0;
padding: 0;
clear: both;
}
#test li {
float: left;
margin: 2px;
padding: 5px 10px;
width: 100px;
text-align: center;
border: solid 1px red;
}
</style>
</head>
<body>
<div id="test">
<ul>
<li>hello</li>
<li>hello</li>
<li>hello</li>
</ul>
<ul>
<li style="width: 352px">hello</li>
</ul>
</div>
</body>
</html>

KDLA
06-05-2006, 10:49 AM
(colspan, what you've used in your table-to-css example, is only applicable to tables. colspan is short for column-span.)

imperial
06-09-2006, 07:45 AM
Thank you so much guys!,NogDog & KDLA, I know now what to do!