HighDots Forums  

Re: Border at top of the page

Cascading Style Sheets Layout/presentation on the WWW (comp.infosystems.www.authoring.stylesheets)


Discuss Re: Border at top of the page in the Cascading Style Sheets forum.



Reply
 
Thread Tools Display Modes
  #1  
Old   
Steve Swift
 
Posts: n/a

Default Re: Border at top of the page - 11-23-2007 , 07:51 AM






Jukka K. Korpela wrote:
Quote:
I don't believe you. I just tested this on IE 7, and there was no such
effect.
I don't believe him either. I tested it with IE6, IE7, Firefox 2,
Netscape 8 and Opera 9.

Only Netscape and Opera showed this variation in the space at the top of
the page. Mind you, those probably are the majority of the browsers that
he normally uses.

Mind you, there's *something* causing the space at the top of the page;
I'm fairly certain that I've seen pages where it was absent, with the
first line of text on the page hard up against the top edge of the
container. I might even have (accidentally) fabricated such a page
myself once; I recall seeing the effect and thinking "how horrid!". I
suspect this is some obscure setting in Opera, though.

--
Steve Swift
http://www.swiftys.org.uk/swifty.html
http://www.ringers.org.uk


Reply With Quote
  #2  
Old   
Gus Richter
 
Posts: n/a

Default Re: Border at top of the page - 11-23-2007 , 04:38 PM






Steve Swift wrote:
Quote:
Jukka K. Korpela wrote:
I don't believe you. I just tested this on IE 7, and there was no such
effect.

I don't believe him either. I tested it with IE6, IE7, Firefox 2,
Netscape 8 and Opera 9.
You don't believe yourself?

Quote:
Mind you, there's *something* causing the space at the top of the page;
I'm fairly certain that I've seen pages where it was absent, with the
first line of text on the page hard up against the top edge of the
container.
Without the Strict DTD, it will be in Quirks Mode and applying
margin:0; to body, the <P>aragraph will be hard up against the top of
the viewport.

With the Strict DTD, the default margin-top value on <P>aragraph will be
applied such that the <P>aragraph is moved down from the top of the
viewport by the amount of the default margin-top on <P>aragraph.

Those are the reasons, I believe, you are asking about. The way to
achieve the "hard up against the top" effect, with the Strict DTD, is to:

<body style="margin:0;">
<p style="margin-top:0; background:yellow;">This is a webpage</p>

where the background:yellow; is only to aid visually.

--
Gus


Reply With Quote
  #3  
Old   
Jukka K. Korpela
 
Posts: n/a

Default Re: Border at top of the page - 11-26-2007 , 09:00 AM



Scripsit Gus Richter:

Quote:
Without the Strict DTD, it will be in Quirks Mode and applying
margin:0; to body, the <P>aragraph will be hard up against the top of
the viewport.
This is part of the oddities of Quirks Mode in Firefox and actually
documented, in a fairly obscure way, at
http://lxr.mozilla.org/seamonkey/sou...tyle/quirk.css

Firefox and relatives suppress the top margin of several elements in
certain contexts. Perhaps the easiest to observe is the case where a <p>
element appears as the first element in a <td> element, especially if
you use borders for the table cell so that the effect is easy to see. It
also happens for <p> at the start of <body>, though this is a somewhat
strange case. (Why would you start a page with a paragraph of text and
not with a heading or with a block containing a logo, links, etc.?)

This is definitely not something general in browsers. Specifically, IE
suppresses the top margin of a <p> at the start of a <td>, but it does
that in both modes (Quirks and Standards).

There's no logic in Firefox in this issue. There is nothing quirky in
browsers' "traditional" behavior, and there was no need to change it in
the standards mode. It's just a matter of browser defaults, describable
in terms of a browser style sheet. If a browser vendor wishes to change
such defaults, he should think twice, and surely shouldn't masquerade it
as a "standards" issue. It's just as mad as it would be to start using
Arial as default font in standards mode and keep using Times New Roman
in quirks mode.

--
Jukka K. Korpela ("Yucca")
http://www.cs.tut.fi/~jkorpela/



Reply With Quote
  #4  
Old   
Gus Richter
 
Posts: n/a

Default Re: Border at top of the page - 11-26-2007 , 11:46 AM



Jukka K. Korpela wrote:
Quote:
Scripsit Gus Richter:

Without the Strict DTD, it will be in Quirks Mode and applying
margin:0; to body, the <P>aragraph will be hard up against the top of
the viewport.

This is part of the oddities of Quirks Mode in Firefox and actually
documented, in a fairly obscure way, at
http://lxr.mozilla.org/seamonkey/sou...tyle/quirk.css

Firefox and relatives suppress the top margin of several elements in
certain contexts. Perhaps the easiest to observe is the case where a <p
element appears as the first element in a <td> element, especially if
you use borders for the table cell so that the effect is easy to see. It
also happens for <p> at the start of <body>, though this is a somewhat
strange case. (Why would you start a page with a paragraph of text and
not with a heading or with a block containing a logo, links, etc.?)

This is definitely not something general in browsers. Specifically, IE
suppresses the top margin of a <p> at the start of a <td>, but it does
that in both modes (Quirks and Standards).

There's no logic in Firefox in this issue. There is nothing quirky in
browsers' "traditional" behavior, and there was no need to change it in
the standards mode. It's just a matter of browser defaults, describable
in terms of a browser style sheet. If a browser vendor wishes to change
such defaults, he should think twice, and surely shouldn't masquerade it
as a "standards" issue. It's just as mad as it would be to start using
Arial as default font in standards mode and keep using Times New Roman
in quirks mode.
This "oddity" is not exclusive to Firefox and relatives. The exact same
behavior is with Opera and Safari - in both Quirks and Standards Mode.

When there is anonymous text, all browsers are without top margin in
either Quirks or Standards Mode, which is the same when <p>aragraph is
used in Quirks Mode. IE is the odd man out only in Standards Mode where
it applies no top margin to <p>aragraph.

--
Gus


Reply With Quote
  #5  
Old   
Ben C
 
Posts: n/a

Default Re: Border at top of the page - 11-26-2007 , 03:30 PM



On 2007-11-26, Jukka K. Korpela <jkorpela (AT) cs (DOT) tut.fi> wrote:
Quote:
Scripsit Gus Richter:

Without the Strict DTD, it will be in Quirks Mode and applying
margin:0; to body, the <P>aragraph will be hard up against the top of
the viewport.

This is part of the oddities of Quirks Mode in Firefox and actually
documented, in a fairly obscure way, at
http://lxr.mozilla.org/seamonkey/sou...tyle/quirk.css

Firefox and relatives suppress the top margin of several elements in
certain contexts. Perhaps the easiest to observe is the case where a <p
element appears as the first element in a <td> element, especially if
you use borders for the table cell so that the effect is easy to see. It
also happens for <p> at the start of <body>, though this is a somewhat
strange case. (Why would you start a page with a paragraph of text and
not with a heading or with a block containing a logo, links, etc.?)

This is definitely not something general in browsers. Specifically, IE
suppresses the top margin of a <p> at the start of a <td>, but it does
that in both modes (Quirks and Standards).
In fact this sounds a lot like what Gérard Talbot was talking about
recently:

http://groups.google.co.uk/group/com...f763337eb69cb6

Quote:
There's no logic in Firefox in this issue. There is nothing quirky in
browsers' "traditional" behavior, and there was no need to change it in
the standards mode. It's just a matter of browser defaults, describable
in terms of a browser style sheet.
Firefox has invented non-standard pseudoselectors ":-moz-first-node" and
":-moz-last-node" to implement this, because what it consists of is
outside the CSS specification.

There's no way to get that behaviour just with default styles using only
a CSS 2.1 conforming implementation. That makes it a quirk and a
standards issue.

As for browsers' "traditional" behaviour, I'm not sure whether IE's
unusual behaviour is an accidental bug or a non-conformance to W3C
specifications because they had something else in mind. Who knows and
who cares?

Quote:
If a browser vendor wishes to change such defaults, he should think
twice, and surely shouldn't masquerade it as a "standards" issue. It's
just as mad as it would be to start using Arial as default font in
standards mode and keep using Times New Roman in quirks mode.

Reply With Quote
  #6  
Old   
Jukka K. Korpela
 
Posts: n/a

Default Re: Border at top of the page - 11-26-2007 , 03:32 PM



Scripsit Gus Richter:

[ Fullquote - always a useful signal. ]

Quote:
When there is anonymous text, all browsers are without top margin in
either Quirks or Standards Mode,
You mean loose text, right? That is, text data directly inside <body>.
It has no margins. Big surprise.

Quote:
which is the same when <p>aragraph is
used in Quirks Mode.
You're just messing things up, really.

Quote:
IE is the odd man out only in Standards Mode
where it applies no top margin to <p>aragraph.
More confusion.

There's nothing illogical in suppressing the top margin of a <p> element
that opens the content of <body>. It can easily be described as
body > p:first-child { margin-top: 0; }
And there was no reason to drop that behavior, and it was illogical to
do so in the name of standards conformance and to make this depend on
the magic incantation, the doctype string.

--
Jukka K. Korpela ("Yucca")
http://www.cs.tut.fi/~jkorpela/



Reply With Quote
  #7  
Old   
Jukka K. Korpela
 
Posts: n/a

Default Re: Border at top of the page - 11-26-2007 , 03:48 PM



Scripsit Ben C:

Quote:
Firefox has invented non-standard pseudoselectors ":-moz-first-node"
and ":-moz-last-node" to implement this, because what it consists of
is outside the CSS specification.
It's not clear what you mean by "this", but several of the cases
discussed _are_ describable in CSS 2.1 terms.

Quote:
There's no way to get that behaviour just with default styles using
only a CSS 2.1 conforming implementation. That makes it a quirk and a
standards issue.
Even if that were the case, it has nothing to do with the question
whether a document contains a particular doctype string or not. That's a
markup issue, quite external to all CSS considerations. Besides, the
HTML specifications do not specify the default rendering of documents,
and they do not require that the default rendering be describable in CSS
2.1 (since HTML is independent of the very existence of CSS) or that it
be described at all.

Quote:
As for browsers' "traditional" behaviour, I'm not sure whether IE's
unusual behaviour is an accidental bug or a non-conformance to W3C
specifications because they had something else in mind.
What non-conformance? A browser may display <p> elements with pink
background on Sundays, and you still cannot claim that it is
non-conforming because of that. And there's nothing unusual in doing
what previous versions did. In fact, that's the sensible way to go,
unless you have good reasons to do otherwise.

Quote:
If a browser vendor wishes to change such defaults, he should think
twice, and surely shouldn't masquerade it as a "standards" issue.
It's just as mad as it would be to start using Arial as default font
in standards mode and keep using Times New Roman in quirks mode.
I guess you quoted that, without commenting on it, because you realized,
ultimately, that I was right and this paragraph summarized my point
well. Thank you.

--
Jukka K. Korpela ("Yucca")
http://www.cs.tut.fi/~jkorpela/



Reply With Quote
  #8  
Old   
Ben C
 
Posts: n/a

Default Re: Border at top of the page - 11-26-2007 , 03:57 PM



On 2007-11-26, Jukka K. Korpela <jkorpela (AT) cs (DOT) tut.fi> wrote:
Quote:
Scripsit Gus Richter:

[ Fullquote - always a useful signal. ]

When there is anonymous text, all browsers are without top margin in
either Quirks or Standards Mode,

You mean loose text, right? That is, text data directly inside <body>.
It has no margins. Big surprise.
I think we're talking about the margin on the <p>, not on the anonymous
block surrounding the loose text. Of course the anonymous block has no
margin.

But the presence of loose text affects whether the margin is suppressed
or not in quirks mode.

i.e. if you have this:

<body>
hello
<p> world
...

The <p> keeps its top margin (in Firefox, quirks or standards modes).
But if you have this:

<body>
<p> world
...

it loses it (in Firefox in quirks mode). You can't do this with
:first-child, because the presence of the bastard anonymous block around
"hello" does not change the fact that in both cases the <p> is still the
first legitimate child of <body>.

You need :-moz-first-node for that (or some other way of implementing
this quirk).

[...]
Quote:
There's nothing illogical in suppressing the top margin of a <p> element
that opens the content of <body>. It can easily be described as
body > p:first-child { margin-top: 0; }
And there was no reason to drop that behavior
I agree that body > p:first-child { margin-top: 0; } would be a
reasonable thing to have in the default stylesheet anyway, although
there are good reasons for sticking to Appendix D of CSS 2.1 (which
doesn't do this).


Reply With Quote
  #9  
Old   
Ben C
 
Posts: n/a

Default Re: Border at top of the page - 11-26-2007 , 04:15 PM



On 2007-11-26, Jukka K. Korpela <jkorpela (AT) cs (DOT) tut.fi> wrote:
Quote:
Scripsit Ben C:

Firefox has invented non-standard pseudoselectors ":-moz-first-node"
and ":-moz-last-node" to implement this, because what it consists of
is outside the CSS specification.

It's not clear what you mean by "this"
By "this" I mean suppressing the top margin of <p> when it is the first
child of body, _except when it is preceded by text_.

Quote:
, but several of the cases discussed _are_ describable in CSS 2.1
terms.
If they are, then they're not quirks. I agree with you about that.

Quote:
There's no way to get that behaviour just with default styles using
only a CSS 2.1 conforming implementation. That makes it a quirk and a
standards issue.

Even if that were the case, it has nothing to do with the question
whether a document contains a particular doctype string or not. That's a
markup issue, quite external to all CSS considerations. Besides, the
HTML specifications do not specify the default rendering of documents,
and they do not require that the default rendering be describable in CSS
2.1 (since HTML is independent of the very existence of CSS) or that it
be described at all.
I know. But we aren't discussing HTML here. Surely I don't need to
remind you this is comp.infosystems.www.authoring.stylesheets.

Implementing a rendering behaviour that's outside the CSS specification
and switching it on based on the doctype string is what I call a quirk.

Quote:
As for browsers' "traditional" behaviour, I'm not sure whether IE's
unusual behaviour is an accidental bug or a non-conformance to W3C
specifications because they had something else in mind.

What non-conformance?
I'm thinking specifically of this one:

http://groups.google.co.uk/group/com...f763337eb69cb6

That is either a bug or a non-conformance. My money's on bug.

Quote:
A browser may display <p> elements with pink background on Sundays,
and you still cannot claim that it is non-conforming because of that.
I do claim that, unless it's using JS.

If there's no style in the cascade that sets background-color: pink on
<p> then <p> must have a transparent background. Your browser is
non-conforming on at least one day out of seven.

[...]
Quote:
If a browser vendor wishes to change such defaults, he should think
twice, and surely shouldn't masquerade it as a "standards" issue.
It's just as mad as it would be to start using Arial as default font
in standards mode and keep using Times New Roman in quirks mode.

I guess you quoted that, without commenting on it, because you realized,
ultimately, that I was right and this paragraph summarized my point
well. Thank you.
Yes, that part was right.


Reply With Quote
  #10  
Old   
Gus Richter
 
Posts: n/a

Default Re: Border at top of the page - 11-27-2007 , 12:30 AM



Jukka K. Korpela wrote:
Quote:
Scripsit Gus Richter:

[ Fullquote - always a useful signal. ]
Actually I felt that I could not cut any portion since it was all
relevant). Sorry that you could not appreciate it.

Quote:
When there is anonymous text, all browsers are without top margin in
either Quirks or Standards Mode,

You mean loose text, right? That is, text data directly inside <body>.
It has no margins. Big surprise.
No, I mean "anonymous text" as it is described in CSS2.1 and described
as "line box" in CSS3 (WD). Nowhere that I could find is it described as
"loose text" - something you made up?

Quote:
which is the same when <p>aragraph is
used in Quirks Mode.

You're just messing things up, really.
I'm disappointed that you could not see the relevance of my introducing
"anonymous text". I suggest that you try the tests not as a child of
<body> but as a child of <div>. This was what interested me as well.

Most certainly you should have noted that I was also reinforcing the
behavior in Quirks Mode that <p> also had no top margin just as
"anonymous text". I don't see how it messed things up for you.

Quote:
IE is the odd man out only in Standards Mode
where it applies no top margin to <p>aragraph.

More confusion.
Perhaps I can clarify for you. My report says that Firefox, Opera,
Safari and IE all apply no top margin to <p> in Quirks Mode. In
Standards Mode, Firefox, Opera and Safari apply top margin to <p>, but
IE does not.

Quote:
[Clipped OT material (causing confusion)]
I simply reported my findings in order to correct your erroneous
contention that Firefox and relatives only were at odds with IE's
interpretation. I did not have an opinion about who is right or wrong,
but only stated it as it is.

--
Gus


Reply With Quote
Reply




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.4
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.