default properties of tags

Discussion in 'HTML' started by Gregor Traven, Jul 7, 2004.

  1. Hi

    This is what happened to me. I was using css to define the body tag. So I
    left the tag in html file empty like this: <body>. In my css I defined
    margin for this body but if I had for example 20px of margin, the displayed
    website in a browser showed 21px I think.Anyways more than 20px as if there
    was one px added to those twenty though it wasn't declared anywhere. After a
    few tries I found out that if I declare <body topmargin="0"> in html, the 20
    px from css remain the 20px that I wanted.
    It was the same with tables, if I didn't put cellspacing="0" in html tag,
    there was at least 1 px of spacing when displayed in a browser.
    My question is: are there such things as default values for tags which would
    explain this strange behaviour? I used Internet Explorer and Opera and both
    shwed the same.

    Thanks for answering

    Gregor
     
    Gregor Traven, Jul 7, 2004
    #1
    1. Advertisements

  2. Gregor Traven

    brucie Guest

    in post: <
    stop your gowd damn complaining. theres a starving child in africa
    somewhere who would love to have a pixel and you're complaining you have
    ONE too many.
    sorry, i gave my crystal ball to a staving african child.
     
    brucie, Jul 8, 2004
    #2
    1. Advertisements

  3. Gregor Traven

    Neal Guest

    I can't address the specifics of your roghe pixel, but see this:

    http://www.w3.org/TR/CSS21/sample.html
     
    Neal, Jul 8, 2004
    #3
  4. Gregor Traven

    DU Guest

    I recommend not to use invalid or deprecated attributes like that. When
    you're facing a particular problem or issue, search or investigate the
    default css values for the browser and in general you'll find the
    values. There is no modern browser which does not allow web authors to
    know these default values.
    MSIE 6 for windows in standards compliant rendering mode will render a
    border around the body with the following (browser default) value:

    html {medium #000000 inset}

    Thus your 1px.

    Important and unknown default browser values
    http://www10.brinkster.com/doctorunclear/HTMLJavascriptCSS/BrowsersDefaultValues.html

    DU
     
    DU, Jul 10, 2004
    #4
  5. I hadn't realized that such values can be found using some JavaScript as
    you do on your page - but I had to find out the method by reading your
    source code, and I'm afraid most authors are quite unaware of such
    possibilities. Besides, most authors would find it very difficult to use
    such methods without any simple tools. And how do we know which values to
    look for? For example, spacing somewhere might be caused by some margin,
    or some padding, or some border.
    You apparently meant
    html {border: medium #000000 inset}
    (which is technically a border around the root element, <html>, not the
    body element).

    But how did you get at that conclusion? I have tried to describe what
    really happens in "quirks" versus "standard" mode on
    MSIE 6 - most documentation of what I had seen was hopelessly incomplete
    - but I did not catch that particular oddity. The oddity nicely reflects
    that "standard" mode is just a different rendering mode - the name is
    misleading, though MSIE 6 admittedly violates W3C specifications
    less in "standard" mode than in "quirks" mode. There is absolutely
    nothing in HTML or CSS specifications that says that the root element
    shall (or even should) have some border by default - and naturally no
    prohibition either.
    What puzzles me is that for border-width, MSIE treats medium as 4px.
    And in fact, if I explicitly set
    html { border-width: medium; }
    the effect differs from the default. (This is easier to see if you also
    set border-color to red, for example.)
    Interesting information, but it displays just small part of all the
    defaults - and can we trust the information derived from what we get by
    printing components of currentStyle? The example suggests otherwise,
    unless I'm mistaken.
     
    Jukka K. Korpela, Jul 11, 2004
    #5
  6. Gregor Traven

    DU Guest

    Good question. Searching, experimentation, empirical deductions.

    For example, spacing somewhere might be caused by some margin,

    Incomplete and sometimes incorrect. The DHTML object model is another
    one with inaccuracies, even contradictions. The documentation on MSIE on
    these issues would certainly benefit from a general and thorough
    clarification.
    Yes, I see what you mean. I can't explain this right now. I even tried
    html {medium #000000 inset}
    and I do not get the default. :)
    I do mention "including a default standard border black inset 1px
    border" instead in another page of my site, not medium.
    I agree. We can't trust these info. I need to investigate this furthermore.

    Thanks

    DU
     
    DU, Jul 11, 2004
    #6
  7. Gregor Traven

    DU Guest

    I checked with Zvon's Javascript DOM factory for non-empty CSS2
    declarations on the root element for style, currentStyle and
    runtimeStyle objects and the values are the same for currentStyle:
    border {medium #000000 inset}

    Using MSIE 6,
    http://www.zvon.org/xxl/JSDOMFactory/ie/novice2.html
    URI to load: http://www.zvon.org/
    Object lookup: document.documentElement.currentStyle
    View filter: non empty
    CSS2 radio button checked

    So, it's somewhat a mystery; for sure, 1px != 4px

    DU
     
    DU, Jul 11, 2004
    #7
    1. Advertisements

Ask a Question

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

You'll need to choose a username for the site, which only take a couple of moments (here). After that, you can post your question and our members will help you out.