Pixel Question

Discussion in 'HTML' started by Sparticus, Nov 1, 2005.

  1. Sparticus

    Sparticus Guest

    I have been doing web development for a while now (as a hobby) but
    there is one thing I never understood. It's about tables and pixels
    widths.

    For example,

    1.) If I make a table at tell it to be 800 pixels wide, with border="1"
    (which I don't think is 1 pixel... but just size 1) is the table
    something like 796 pixels wide, ple 4 pixels for the border? Or 800
    pixels wide, plus 4 pixels for the border? (a total of 804).

    2.) If I do the same thing as question 1, but with no border, I assume
    my table is in fact 800 pixels wide... so, can I toss in an 800 pixel
    wide image and have it fit perfectly (none if it is clipped)?

    3.) I normally always set my cellspacing and cellpadding to zero, but
    if I don't, how does that affect the answers to the other questions?



    I understand I'm asking allot... but it's always bothered me and I
    never found any documentation to help me. if anyone can answer these
    questions for me I'd be very grateful.

    Thanx in advance!

    Ryan Ritten
    Sparticus, Nov 1, 2005
    #1
    1. Advertising

  2. Sparticus

    Neredbojias Guest

    With neither quill nor qualm, Sparticus quothed:

    > I have been doing web development for a while now (as a hobby) but
    > there is one thing I never understood. It's about tables and pixels
    > widths.
    >
    > For example,
    >
    > 1.) If I make a table at tell it to be 800 pixels wide, with border="1"
    > (which I don't think is 1 pixel... but just size 1) is the table
    > something like 796 pixels wide, ple 4 pixels for the border? Or 800
    > pixels wide, plus 4 pixels for the border? (a total of 804).


    The inner width of the table is 800px. Even in IE.

    > 2.) If I do the same thing as question 1, but with no border, I assume
    > my table is in fact 800 pixels wide... so, can I toss in an 800 pixel
    > wide image and have it fit perfectly (none if it is clipped)?


    There's white space to consider. If your markup handles that correctly,
    an image can fit "perfectly" in most browsers.

    > 3.) I normally always set my cellspacing and cellpadding to zero, but
    > if I don't, how does that affect the answers to the other questions?


    Both add inter-cell spacing with different effects. For example,
    padding will show *cell* background color and spacing won't.

    > I understand I'm asking allot... but it's always bothered me and I
    > never found any documentation to help me. if anyone can answer these
    > questions for me I'd be very grateful.
    >
    > Thanx in advance!
    >
    > Ryan Ritten
    >
    >


    --
    Neredbojias
    Contrary to popular belief, it is believable.
    Neredbojias, Nov 1, 2005
    #2
    1. Advertising

  3. Sparticus wrote:

    "I have been doing web development for a while now (as a hobby) but
    there is one thing I never understood. It's about tables and pixels
    widths.

    For example,

    1.) If I make a table at tell it to be 800 pixels wide, with border="1"
    (which I don't think is 1 pixel... but just size 1) is the table
    something like 796 pixels wide, ple 4 pixels for the border? Or 800
    pixels wide, plus 4 pixels for the border? (a total of 804).

    2.) If I do the same thing as question 1, but with no border, I assume
    my table is in fact 800 pixels wide... so, can I toss in an 800 pixel
    wide image and have it fit perfectly (none if it is clipped)?

    3.) I normally always set my cellspacing and cellpadding to zero, but if
    I don't, how does that affect the answers to the other questions?

    I understand I'm asking allot... but it's always bothered me and I never
    found any documentation to help me. if anyone can answer these questions
    for me I'd be very grateful.

    Thanx in advance!

    Ryan Ritten"

    Yes, as already pointed out the table should be 800 pixels wide (inner),
    plus the border. Of course, if you simply want the table to conform to
    the dimensions of the table content, then specifying a width isn't
    necessary at all.

    I've been under the impression that with html, border, cellpadding, and
    cellspacing values are in pixels.

    Wasn't there an older version of Navigator or Explorer that would add a
    a value of 1 or 2 to cellpadding and/or cellspacing if a value of 0
    wasn't specified ? At any rate, even if redundant, it might be a good
    idea to specify values of 0 if that's what you want.

    Later, Art.
    X l e c t r i c, Nov 2, 2005
    #3
  4. Sparticus

    kchayka Guest

    Sparticus wrote:
    >
    > 1.) If I make a table... with border="1"
    > (which I don't think is 1 pixel... but just size 1)


    The border width really is 1 pixel. There is a separate border around
    each cell, plus the outside of the table. It looks wider because of
    cellspacing, which usually defaults to about 2 pixels, making the border
    appear to be about 4 pixels wide.

    If you really want a 1-pixel border, look up border-collapse:
    <URL:http://www.w3.org/TR/CSS21/tables.html#borders>

    > 3.) I normally always set my cellspacing and cellpadding to zero, but
    > if I don't, how does that affect the answers to the other questions?


    <URL:http://www.w3.org/TR/html401/struct/tables.html#adef-cellspacing>
    There is also a diagram there that may help.

    --
    Reply email address is a bottomless spam bucket.
    Please reply to the group so everyone can share.
    kchayka, Nov 2, 2005
    #4
    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. Sangeeta

    Pixel Width of Char in Web App

    Sangeeta, Aug 14, 2003, in forum: ASP .Net
    Replies:
    3
    Views:
    1,082
    Jerry III
    Aug 15, 2003
  2. Kirk Graves

    point to pixel conversion

    Kirk Graves, Mar 4, 2004, in forum: ASP .Net
    Replies:
    2
    Views:
    19,151
    Kirk Graves
    Mar 4, 2004
  3. Oracle3001

    Pixel Information Question

    Oracle3001, Oct 6, 2003, in forum: Java
    Replies:
    0
    Views:
    339
    Oracle3001
    Oct 6, 2003
  4. André Wagner

    Fastest pixel by pixel operation

    André Wagner, Mar 17, 2008, in forum: Java
    Replies:
    12
    Views:
    1,025
    Larry A Barowski
    Mar 19, 2008
  5. Raymond Luxury-Yacht

    Python graphics question:pixel scrolling

    Raymond Luxury-Yacht, Aug 29, 2008, in forum: Python
    Replies:
    2
    Views:
    824
    Diez B. Roggisch
    Aug 29, 2008
Loading...

Share This Page