Click to See Complete Forum and Search --> : Tables... help!


NeueZiel
12-31-2002, 12:00 AM
Anyone see what's wrong with this code?

----------------------------
<html>
<head>
<title>Untitled</title>
<link rel="stylesheet" href="style.css" type="text/css">
</head>
<body>
<div style="position: absolute; top: 0px; left: 0px; width: 150px;">
<table width="150" border="0" cellpadding="0" cellspacing="0">
<tr>
<td><img src="mnav.png" width="150" height="11">
</td>
</tr>
<tr>
<td><center><span class="text">Main<br>Links<br>Contact</span></center>
</td>
</tr>
</table>
</div>
</body>
</html>

-------------------------------
NOTE: The title I'm going to change, and I know I don't have a doctype specified, but I don't usually insert those until I have a so-called "base" layout down, then I correct stuff.

The problems I'm having are...
1) It's not starting at 0x0, it's all the way to the left, but starts a few px down from the top.
2) It seems like there's a massive cellspacing, because between that image and the TD placed below it, there's a HUGE gap.

Any help would be appreciated.

Thanks!

jdavia
12-31-2002, 04:30 AM
Nothing!
If you put a border="1" in the table You will see that it is at the top. What you see is the image border.

Stefan
12-31-2002, 07:25 AM
Originally posted by NeueZiel
Anyone see what's wrong with this code?


I would say that you are using a <table> at all. Why on earth are you doing that in the first place?

Try this instead

<div style="position: absolute; top: 0px; left: 0px; width: 150px; text-align:center;">
<img src="mnav.png" width="150" height="11">
<div class="text">Main<br>Links<br>Contact</div>
</div>

NeueZiel
12-31-2002, 05:31 PM
With border=0 the border should be eliminated entirely... I've gotten that to work before.

And Stefan, with the way you posted about doing it, could I keep adding images and such just doing <BR> between each line, or would I have to do something else?

EDIT: The way you posted didn't work. I'll try to be more descriptive.. The text is working fine, but around the image (top and bottom only), there's a spacing of a few px..

I would post a URL, but seeing as I'm running this locally, that's not possible.

SECOND EDIT: I got it fixed... all that was wrong was that it wanted a <BR> right after the image... Thanks for the help!

Stefan
01-01-2003, 01:31 AM
Originally posted by NeueZiel
The text is working fine, but around the image (top and bottom only), there's a spacing of a few px..


JFYI, if you are setting a Gecko browser into standards compatible parsing mode (by using a compleate and correct STRICT doctype as you should) you can also get a a few px spacing between images.

This depends on that text by default is {vertical-align:baseline} and images are handled the same as text. To get rid of the space you have to position the image {vertical-align:bottom}.