how to replace table with div tag..?

J

jaYPee

anyone know how can I replace this code using only the div tag? I have
tried everything but I can't do it.

here's the code using table:

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html;
charset=iso-8859-1">
<title>Untitled Document</title>
</head>

<body>
<table width="799" align="center" style="border:1px solid #999999">
<tr>
<td><div id="sidebar" style="border:1px solid #999999; width:
160px; float:left">
<h2>sidebar</h2>
<ul id="nav">
<li><a href="#">Test Link One</a></li>
<li><a href="#">Test Link Two</a></li>
<li><a href="#">Test Link Three</a></li>
<li><a href="#">Test Link Four</a></li>
<li><a href="#">Test Link Five</a></li>
</ul>
<p>Additional sidebar content.</p></div>

<div id="maincontent" style="border:1px solid #999999; margin:0 0 0
2px; float:left">
<h2>main content</h2>
<p>Testing</p>
</div></td>
</tr>
</table>
</body>
</html>

thanks for any help
 
N

Neredbojias

With neither quill nor qualm, jaYPee quothed:
anyone know how can I replace this code using only the div tag? I have
tried everything but I can't do it.
<snip>

What's not working with the div?
 
N

Neredbojias

With neither quill nor qualm, Toby Inkster quothed:
Here you are:

<div>

How uncharacteristically thoughtless of you! You forgot to close the
tag (</div>).
 
R

rf

[irrelevant crosspost snipped]
With neither quill nor qualm, Toby Inkster quothed:


How uncharacteristically thoughtless of you! You forgot to close the
tag (</div>).

Tags are not "closed". They simply stand alone, by themselves.

Elements, on the other hand, are usually closed. So, a div *element* must
have a closing tag.

The OP however asked (incorrctly) about using a div tag and Toby responded
correctly. If the OP had asked about a div element the response would
probably have been
<div></div>

Cheers
Richard.
 
D

Dima Gofman

tada...
here it is, but there's a bit of a problem with firefox, the
all-encompassing div seems to be squashed at the top, no time to figure
out why right now - probably something simple that i've overlooked

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html;
charset=iso-8859-1">
<title>Untitled Document</title>
<style type="text/css">
div{
border:1px solid #999999;
}
body div{
width:799px;
margin: auto;
padding:2px;
}
div#sidebar{
width: 160px;
float:left;
}
div#maincontent{
margin:0 0 0 2px;
width: auto; /*or 799-160=639 to take up all the available area*/
float:left; /*or leave width:auto and remove float:left*/
}
</style>
</head>


<body>
<div>
<div id="sidebar">
<h2>sidebar</h2>
<ul id="nav">
<li><a href="#">Test Link One</a></li>
<li><a href="#">Test Link Two</a></li>
<li><a href="#">Test Link Three</a></li>
<li><a href="#">Test Link Four</a></li>
<li><a href="#">Test Link Five</a></li>
</ul>
<p>Additional sidebar content.</p>
</div>
<div id="maincontent">
<h2>main content</h2>
<p>Testing</p>
</div>
</div>
</body>
</html>
 
N

Neredbojias

With neither quill nor qualm said:
[irrelevant crosspost snipped]
With neither quill nor qualm, Toby Inkster quothed:


How uncharacteristically thoughtless of you! You forgot to close the
tag (</div>).

Tags are not "closed". They simply stand alone, by themselves.

Elements, on the other hand, are usually closed. So, a div *element* must
have a closing tag.

The OP however asked (incorrctly) about using a div tag and Toby responded
correctly. If the OP had asked about a div element the response would
probably have been
<div></div>

Grrr. But it annoys me when Toby is right even more than it does when
you are.

Fortunately, the frequency of such perturbations is tolerable.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
474,432
Messages
2,571,681
Members
48,796
Latest member
Greg L.

Latest Threads

Top