dcsimg
www.webdeveloper.com
Results 1 to 5 of 5

Thread: Tables... help!

  1. #1
    Join Date
    Dec 2002
    Location
    ????
    Posts
    3

    Tables... help!

    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!

  2. #2
    Join Date
    Dec 2002
    Location
    Lake Havasu City, Arizona
    Posts
    527
    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.

  3. #3
    Join Date
    Nov 2002
    Posts
    984

    Re: Tables... help!

    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>

  4. #4
    Join Date
    Dec 2002
    Location
    ????
    Posts
    3

    Solved

    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!
    Last edited by NeueZiel; 12-31-2002 at 11:02 PM.

  5. #5
    Join Date
    Nov 2002
    Posts
    984

    Re: Solved

    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}.

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
HTML5 Development Center



Recent Articles