Results 1 to 9 of 9

Thread: table width

  1. #1
    Join Date
    Jun 2007
    Posts
    17
    Thanks
    1
    Thanked 0 Times in 0 Posts

    Default table width

    when i start to put text or images into a table, the width of the columns starts to change so i end up with some wide and some narrow columns, how do i make all the coluns a specific width?

    thanks

  2. #2
    Join Date
    Feb 2007
    Posts
    293
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    Table cells will expand to fit the content unless you set them to have a specific width. To set a width, add to the cells:

    <td style="width:150px;">

    Or you could give each cell a class, and set the width for that class with css.

    But tables really shouldn't be used for layout. Try to learn about divs and css for layout. It will make for a more flexible page.

  3. #3
    Join Date
    Jun 2007
    Posts
    17
    Thanks
    1
    Thanked 0 Times in 0 Posts

    Default

    i'm not using the table for the whole site layout, it is a table with photos and links in which is displayed on the site using an iframe, so i'm not sure how to do this with divs, but if you have any suggestions i'll be happy to consider something new.

    also whilst on the subject of div's, how do you set an absolute position for them, i have set the left and top properties for the div, and it appears in the right position in dreamweaver, but when i preview it in firefox, it just shows in the top left of the page. any suggestions?

    thanks

  4. #4
    Join Date
    Feb 2007
    Posts
    293
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    An absolute-positioned element is positioned according to its containing block. If there's no containing div, the position is set according to the browser window. So this

    #the_div {position:absolute; top:0; left:0;}

    would put the_div at the very top and left of the screen, regardless of other content..

    If the_div was inside another div, it will be positioned according to that containing div. So if the_div was inside another div called "container", it would be positioned at the top and left of "container".

  5. #5
    Join Date
    Jun 2007
    Posts
    17
    Thanks
    1
    Thanked 0 Times in 0 Posts

    Default

    the div i'm having trouble with is just on the page, not in another div, it has a top property of 100 and a left property of 500, but it still appears in the top left corner of the page when i preview it, any suggestions why this might be, i'm confused by this one.


    EDIT
    i've tried this on an existing page which i have to see if it does the same, but not quite. rather than putting the div in the top left corner, it is aligning it to the left hand side of the page, but putting it between other peices of content depending on where i insert the code into the html editor. does this make a difference?

    thanks
    Last edited by kpw; 06-07-2007 at 08:33 PM.

  6. #6
    Join Date
    Feb 2007
    Posts
    293
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    Can you post a link?

  7. #7
    Join Date
    Jun 2007
    Posts
    17
    Thanks
    1
    Thanked 0 Times in 0 Posts

    Default

    sorry, i don't have a link, i have attached a copy of the file though. as i can't upload html, i had to alter the file extension, so change it back from .doc to .html and hopefully it will be ok to check.

    Attachment 1055

    thanks

  8. #8
    Join Date
    Feb 2007
    Posts
    293
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    It's your doctype. Try this:
    Code:
    <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">

  9. #9
    Join Date
    Jun 2007
    Posts
    17
    Thanks
    1
    Thanked 0 Times in 0 Posts

    Default

    That works well, thank you very much

Bookmarks

Posting Permissions

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