www.webdeveloper.com
Page 1 of 3 123 LastLast
Results 1 to 15 of 40

Thread: Adding style to a table...

  1. #1
    Join Date
    May 2003
    Posts
    373

    Adding style to a table...

    Is there any way to set the HEIGHT of a table using CSS?

    Thanx.

  2. #2
    Join Date
    Dec 2002
    Location
    Manchester, UK
    Posts
    6,276
    How about this:

    <table style="height:100px;" width="100">
    Every fight is a food fight when you’re a cannibal.

  3. #3
    Join Date
    May 2003
    Posts
    373
    Tried using the HEIGHT property, but the table isn't recognizing it. It recognizes the WIDTH just fine, but not the HEIGHT.

    Here's what I'm doing:

    HTML
    ----------
    <table id="main">

    CSS
    ----------
    #main {
    height: 100%;
    width: 600px;
    }

    Am I doing something wrong? Any other ideas?

  4. #4
    Join Date
    Dec 2002
    Location
    Manchester, UK
    Posts
    6,276
    What browser are you using because I'm using IE 6.something on win XP and what you wrote works fine.
    Every fight is a food fight when you’re a cannibal.

  5. #5
    Join Date
    May 2003
    Posts
    373
    I've tried it on IE6, NS7, O7, and M1.

    Thanx.

  6. #6
    Join Date
    Dec 2002
    Location
    Manchester, UK
    Posts
    6,276
    I've put the style's on 1 line just because that's the way I code and I put a border around the table just so you can see the effect. This works on mine how about yours.
    Attached Files Attached Files
    Every fight is a food fight when you’re a cannibal.

  7. #7
    Join Date
    May 2003
    Posts
    373
    Looks like it is working when we use the inline styles, but when I attempt to place the styling in a css file, the height property doesn't want to work for some reason.

  8. #8
    Join Date
    Dec 2002
    Location
    Manchester, UK
    Posts
    6,276
    I can't remember how to link to a separate css file so I can't test that, can you refresh my memory and I might be able to.
    Every fight is a food fight when you’re a cannibal.

  9. #9
    Join Date
    May 2003
    Posts
    373
    <link type="text/css" rel="stylesheet" href="default.css">

    in the head section.

    Thanx.

  10. #10
    Join Date
    Dec 2002
    Location
    Manchester, UK
    Posts
    6,276
    Well I tried it and it worked fine, this is the page source:

    <html>

    <head>

    <title>Tables With Style</title>

    <link type="text/css" rel="stylesheet" href="default.css" />

    </head>

    <body>

    <table id="main" border="1">
    <tr><td>

    a

    </td></tr>
    </table>

    </body>

    </html>

    and this is the file default.css:

    #main{height: 100%;width: 600px;}

    and there's not a single problem with it.
    Every fight is a food fight when you’re a cannibal.

  11. #11
    Join Date
    May 2003
    Posts
    373
    Ah ha!

    Now add the following line as the VERY FIRST line in your HTML...even before the <html> line:

    <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">

    Then take a look at it.

    8^)>

  12. #12
    Join Date
    Jan 2003
    Location
    Atlanta, GA
    Posts
    571
    Its actually working. The table is already 100% of its contents.It will not stretch until the bottom of the screen.

    For more info on 100% screen height, refer to one of my earlier post. Sorry, need to rush so cant help u more right now.

  13. #13
    Join Date
    Dec 2002
    Location
    Manchester, UK
    Posts
    6,276
    Yep you're right, when I tried it I didn't bother with a DOCTYPE or meta tag.
    I forgot that with a DOCTYPE it puts the browser in standards mode rather than quirks mode.
    In that case I don't know how to help you, sorry.
    Every fight is a food fight when you’re a cannibal.

  14. #14
    Join Date
    Nov 2002
    Location
    XYZZY - UK
    Posts
    1,760
    Present me with a logical an semantically valid argument why you require the <table> element to have the same height dimension of the user-agent canvas and I might just divulge on how it could be achieved using CSS alone.

  15. #15
    Join Date
    May 2003
    Posts
    373
    What does that mean? Does that mean that if I can't come up with a "logical and semantically valid argument" that satisfies your nerual network, that you will not grant me any sort of assistance?

    All I am trying to do is make a page that looks like the following, using tables instead of frames as the frames don't show up properly in all browsers I've tested on (IE6, O7, NS7, M1):

    http://home.bendcable.com/theallensplace/

    Thanx.

    (I hope.)

    8^)>

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