HTML problem

Miscellaneous Forums/General Discussion/HTML problem

I can't get the top table to butt against the very top of the browser. Also can't get it up against the left also. Can someone point out what's up?

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<HTML>
<HEAD>
<TITLE>Basic Layout Template</TITLE>
<HEAD>
<BODY>


<table align="center" cellpadding="0" cellspacing="0" width="720" bgcolor="#808080">
<tr>
<td width="720" height=100" valign="top">

</td>
</tr>


</table>

<table align="center" border="2">

<tr>
<td align="center" colspan="3">Topper</td>
</tr>

<tr>
<td align="center" rowspan="2">Left</td>
<td align="center">Mid1</td>
<td rowspan="2">Right</td>
</tr>

<tr>
<td>Mid2</td>
</tr>

<tr>
<td align="center" colspan="3">Bottom</td>
</tr>

</table>


</BODY>
</HTML>


<body leftmargin=0 topmargin=0 marginwidth=0 marginheight=0>


I'm no expert but I think you need to be looking at CSS for this.
body { margin: 0px 0px 0px 0px; }


Both ways will work, but you should look into learning CSS; the plain advantage is that you can control all of the design in your website from one stylesheet.

If you're doing websites for clients, CSS is a must; clients will always come back to you after the design has gone from concept to actual HTML website and say things like 'Uh... We decided that we want the left menu in pink instead of blue - sounds easy, should only take you 5 mins.' - when actually, it means going through every page in their 100 page website and changing the HTML. With CSS you avoid this because every page takes the style information from the 1 file - hence only one update.

Another thing is I can't get a picture to fit perfectly in a cell. There's a small space at the bottom I can't seem to get rid of. It's creating a small gap between the bottom edge of the pic and bottom of the table. I have cellpadding set to zero and the image border set to zero. No table border and no cellspacing. /puzzled

But, thanks for the tips so far. I now have a .css file linked into my page. XD

Contrary to HTML specifications, msie and maybe other browser too tend to explode cells when there's a linebreak within the TD tag pair of the HTML text. So make sure to have no linebreaks or text within the cell.

Not sure if this is going to help you, it helped me some years ago.

Thank jfk you were right. I put it on one line and the tiny space is gone now. Thanks man. Note to self: When dealing with images, keep the <td> and </td> on the same line. :)

Doing this manually in notepad is actually getting fun. =x

Doing this manually in notepad is actually getting fun.
I said more or less the same thing to somebody in IRC a few minutes ago.

I'm busy doing my own website, and, while I still like to use Nvu to a point, I find myself manually editing HTML code more and more and I'm also getting to grips with PHP and CSS quite nicely, too.

Have you tried Notepad++? You probably should!