HTML Row Height

Discussion in 'HTML' started by Carl Gilbert, Dec 6, 2004.

  1. Carl Gilbert

    Carl Gilbert Guest

    Hi

    Simple question...

    I have the following code which will give me a row 1 pixel high:

    <TR>
    <TD height="1">
    </TD>
    </TR>

    However, when I add the following line:

    <IMG src="<%=filler%>" height="1" width="100">

    in the <TD> tag, the line then expands to about 10 or 15 pixels.

    I know the values are minimums but I cannot see anything here that would
    force the line to increase in height.

    nb. The 'filler' image is just a 1x1 black pixel gif.

    Does anyone know what might be causing this and can provide a resolution to
    the problem.

    Regards, Carl Gilbert
     
    Carl Gilbert, Dec 6, 2004
    #1
    1. Advertising

  2. Carl Gilbert wrote:

    > I have the following code which will give me a row 1 pixel high:
    >
    > <TR>
    > <TD height="1">


    Invalid markup.

    > However, when I add the following line:
    >
    > <IMG src="<%=filler%>" height="1" width="100">
    >
    > in the <TD> tag, the line then expands to about 10 or 15 pixels.


    This has to do with line height. Images are inline data and are (in this
    instance at least) treated as character data. The font size therefore
    influences the minimum height of the container.

    > nb. The 'filler' image is just a 1x1 black pixel gif.


    So set a border on some cells instead of simulating it with bandwidth and
    maintainence unfriendly markup and graphics.

    --
    David Dorward <http://blog.dorward.me.uk/> <http://dorward.me.uk/>
    Home is where the ~/.bashrc is
     
    David Dorward, Dec 6, 2004
    #2
    1. Advertising

  3. Carl Gilbert

    Carl Gilbert Guest

    Is there no way to override to height of the column should it contain an
    image.

    Reason being, I am using a image 5 pixels high and the height pf the inline
    data you mentioned exceeds my required height.

    Regards, Carl



    "Carl Gilbert" <> wrote in message
    news:pK2td.540$...
    > Hi
    >
    > Simple question...
    >
    > I have the following code which will give me a row 1 pixel high:
    >
    > <TR>
    > <TD height="1">
    > </TD>
    > </TR>
    >
    > However, when I add the following line:
    >
    > <IMG src="<%=filler%>" height="1" width="100">
    >
    > in the <TD> tag, the line then expands to about 10 or 15 pixels.
    >
    > I know the values are minimums but I cannot see anything here that would
    > force the line to increase in height.
    >
    > nb. The 'filler' image is just a 1x1 black pixel gif.
    >
    > Does anyone know what might be causing this and can provide a resolution
    > to the problem.
    >
    > Regards, Carl Gilbert
    >
     
    Carl Gilbert, Dec 6, 2004
    #3
  4. On Mon, 06 Dec 2004 19:50:45 +0000, Carl Gilbert wrote:

    >
    > Does anyone know what might be causing this and can provide a resolution to
    > the problem.


    Nope, sorry.

    But I have to respond just to keep my stats high. later...

    --
    Jeffrey D. Silverman |
    Website | http://www.newtnotes.com

    Drop "PANTS" to reply by email
     
    Jeffrey Silverman, Dec 6, 2004
    #4
  5. Carl Gilbert

    Mark Parnell Guest

    Previously in alt.html, Jeffrey Silverman <> said:

    > But I have to respond just to keep my stats high. later...


    Cheat! Cheat! Toby, he's padding the stats...

    --
    Mark Parnell
    http://www.clarkecomputers.com.au
     
    Mark Parnell, Dec 6, 2004
    #5
  6. On Tue, 07 Dec 2004 09:09:52 +1100, Mark Parnell wrote:

    > Cheat! Cheat! Toby, he's padding the stats...


    Well, I am trying to post original content as well. We'll see who's left
    off the stats page *this* week.

    Although admittedly I am going on a trip for five days starting Thursday
    and I know that that is going to eat into my posting quantity.

    Quantity not quality, that's my motto!

    oh. hm. no, it's not. I really don't have a motto, CTTOI.

    later...

    --
    Jeffrey D. Silverman |
    Website | http://www.newtnotes.com

    Drop "PANTS" to reply by email
     
    Jeffrey Silverman, Dec 6, 2004
    #6
  7. David Dorward <> wrote:

    >> <TR>
    >> <TD height="1">

    >
    > Invalid markup.


    No, it's valid HTML 4.01 Transitional (assuming suitable context of
    course).

    >> However, when I add the following line:
    >>
    >> <IMG src="<%=filler%>" height="1" width="100">
    >>
    >> in the <TD> tag, the line then expands to about 10 or 15 pixels.

    >
    > This has to do with line height.


    In a sense yes.

    > Images are inline data and are (in this
    > instance at least) treated as character data. The font size therefore
    > influences the minimum height of the container.


    Not quite. The image itself has the height of one pixel. But, looking
    through the URL of the OP's page in my crystal ball, I see that the cell
    contains white space character as well. There's a difference between
    <td><img ...></td>
    and
    <td> <img ...> </td>
    and line breaks are effectively treated as spaces, so the latter is the
    same as
    <td>
    <img ...>
    </td>
    (well, in principle it isn't, but let's not go into finer points in SGML
    that browser vendors missed). And it's the space character(s) that impose
    some minimum height. Whether this is correct is a different issue (it might
    be argued that white space should be treated as separators only, not
    rendered as such), but anyway it's what browsers generally do.

    So removing the white space so that the <td> element contains nothing but
    the <img> element makes the cell height smaller. But to get to one pixel,
    you need to set the cell spacing (which is typically two pixels by default)
    to zero, either with cellspacing="0" in the <table> tag or using
    padding:0 in CSS in a rule that applies to the cell.

    >> nb. The 'filler' image is just a 1x1 black pixel gif.

    >
    > So set a border on some cells instead of simulating it with bandwidth and
    > maintainence unfriendly markup and graphics.


    That's good advice, and it makes the table structure better (helping
    nonvisual user agents render it more meaningfully, among other things).

    --
    Yucca, http://www.cs.tut.fi/~jkorpela/
    Pages about Web authoring: http://www.cs.tut.fi/~jkorpela/www.html
     
    Jukka K. Korpela, Dec 6, 2004
    #7
  8. Carl Gilbert

    Mark Parnell Guest

    Previously in alt.html, Jeffrey Silverman <> said:

    > Well, I am trying to post original content as well. We'll see who's left
    > off the stats page *this* week.


    Probably me again. :-( I'm only here 5 days a week.

    --
    Mark Parnell
    http://www.clarkecomputers.com.au
     
    Mark Parnell, Dec 6, 2004
    #8
  9. Carl Gilbert

    Carl Gilbert Guest

    Thanks for the adive Jukka, this fixed the problem just fine.

    And yes, I will bear in mind Davids advice on not using images for 1 pixel
    lines but in this case, my line is 5 pixels high.

    Regards, Carl




    "Jukka K. Korpela" <> wrote in message
    news:Xns95B8867396C0jkorpelacstutfi@193.229.0.31...
    > David Dorward <> wrote:
    >
    >>> <TR>
    >>> <TD height="1">

    >>
    >> Invalid markup.

    >
    > No, it's valid HTML 4.01 Transitional (assuming suitable context of
    > course).
    >
    >>> However, when I add the following line:
    >>>
    >>> <IMG src="<%=filler%>" height="1" width="100">
    >>>
    >>> in the <TD> tag, the line then expands to about 10 or 15 pixels.

    >>
    >> This has to do with line height.

    >
    > In a sense yes.
    >
    >> Images are inline data and are (in this
    >> instance at least) treated as character data. The font size therefore
    >> influences the minimum height of the container.

    >
    > Not quite. The image itself has the height of one pixel. But, looking
    > through the URL of the OP's page in my crystal ball, I see that the cell
    > contains white space character as well. There's a difference between
    > <td><img ...></td>
    > and
    > <td> <img ...> </td>
    > and line breaks are effectively treated as spaces, so the latter is the
    > same as
    > <td>
    > <img ...>
    > </td>
    > (well, in principle it isn't, but let's not go into finer points in SGML
    > that browser vendors missed). And it's the space character(s) that impose
    > some minimum height. Whether this is correct is a different issue (it
    > might
    > be argued that white space should be treated as separators only, not
    > rendered as such), but anyway it's what browsers generally do.
    >
    > So removing the white space so that the <td> element contains nothing but
    > the <img> element makes the cell height smaller. But to get to one pixel,
    > you need to set the cell spacing (which is typically two pixels by
    > default)
    > to zero, either with cellspacing="0" in the <table> tag or using
    > padding:0 in CSS in a rule that applies to the cell.
    >
    >>> nb. The 'filler' image is just a 1x1 black pixel gif.

    >>
    >> So set a border on some cells instead of simulating it with bandwidth and
    >> maintainence unfriendly markup and graphics.

    >
    > That's good advice, and it makes the table structure better (helping
    > nonvisual user agents render it more meaningfully, among other things).
    >
    > --
    > Yucca, http://www.cs.tut.fi/~jkorpela/
    > Pages about Web authoring: http://www.cs.tut.fi/~jkorpela/www.html
    >
    >
     
    Carl Gilbert, Dec 6, 2004
    #9
  10. Carl Gilbert

    Mark Parnell Guest

    Previously in alt.html, Carl Gilbert <> said:

    > Thanks for the adive Jukka, this fixed the problem just fine.


    You mean the one I just answered in another thread? Thanks for that.

    > And yes, I will bear in mind Davids advice on not using images for 1 pixel
    > lines but in this case, my line is 5 pixels high.


    LOL.
    You *are* kidding, right?

    BTW: Please don't post upside down.
    http://www.allmyfaqs.com/faq.pl?How_to_post
    http://en.wikipedia.org/wiki/Top-posting

    This will help:
    http://home.in.tum.de/~jain/software/oe-quotefix/

    --
    Mark Parnell
    http://www.clarkecomputers.com.au
     
    Mark Parnell, Dec 6, 2004
    #10
  11. Carl Gilbert

    Carl Gilbert Guest

    Sorry Mark.

    Thanks for the reply. I did not initally realise the two were related. I
    would have thought that enev though the image exceeds that of the default
    text height, the image would just override the text.

    Removed the white space in the areas in which this problem was present and
    it also ficed the problem.

    Regards, Carl


    "Mark Parnell" <> wrote in message
    news:...
    > Previously in alt.html, Carl Gilbert <> said:
    >
    >> Thanks for the adive Jukka, this fixed the problem just fine.

    >
    > You mean the one I just answered in another thread? Thanks for that.
    >
    >> And yes, I will bear in mind Davids advice on not using images for 1
    >> pixel
    >> lines but in this case, my line is 5 pixels high.

    >
    > LOL.
    > You *are* kidding, right?
    >
    > BTW: Please don't post upside down.
    > http://www.allmyfaqs.com/faq.pl?How_to_post
    > http://en.wikipedia.org/wiki/Top-posting
    >
    > This will help:
    > http://home.in.tum.de/~jain/software/oe-quotefix/
    >
    > --
    > Mark Parnell
    > http://www.clarkecomputers.com.au
     
    Carl Gilbert, Dec 6, 2004
    #11
  12. Jukka K. Korpela wrote:

    >>> <TD height="1">

    >>
    >> Invalid markup.

    >
    > No, it's valid HTML 4.01 Transitional (assuming suitable context of
    > course).


    Oh yes, I was mixing it up with the <table> element which suffered a width
    attribute but not height. This is what comes of not using deprecated markup
    for so long.

    --
    David Dorward <http://blog.dorward.me.uk/> <http://dorward.me.uk/>
    Home is where the ~/.bashrc is
     
    David Dorward, Dec 6, 2004
    #12
  13. Carl Gilbert

    Mark Parnell Guest

    Previously in alt.html, Carl Gilbert <> said:

    > Sorry Mark.


    I forgive you this time, but please don't top-post again.

    --
    Mark Parnell
    http://www.clarkecomputers.com.au
     
    Mark Parnell, Dec 6, 2004
    #13
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. W@cek
    Replies:
    0
    Views:
    1,642
    W@cek
    Mar 31, 2005
  2. Replies:
    0
    Views:
    582
  3. Wotney
    Replies:
    1
    Views:
    549
    Flinky Wisty Pomm
    Oct 25, 2006
  4. tshad
    Replies:
    1
    Views:
    1,735
    bruce barker
    Mar 8, 2007
  5. D
    Replies:
    0
    Views:
    255
Loading...

Share This Page