HighDots Forums  

Default anchor rendering, HTML vs CSS

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


Discuss Default anchor rendering, HTML vs CSS in the Cascading Style Sheets forum.



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

Default Default anchor rendering, HTML vs CSS - 10-10-2009 , 08:43 PM






From HTML4:
User agents generally render links in such a way as to make them
obvious to users (underlining, reverse video, etc.). The exact
rendering depends on the user agent. Rendering may vary according to
whether the user has already visited the link or not.

From CSS2:
'text-decoration'
Value: none | [ underline || overline || line-through || blink ]
Quote:
inherit
Initial: none
Applies to: all elements
Inherited: no (see prose)
Percentages: N/A
Media: visual

This property describes decorations that are added to the text of an
element. If the property is specified for a block-level element, it
affects all inline-level descendants of the element. If it is
specified for (or affects) an inline-level element, it affects all
boxes generated by the element.

----

From my understanding, these two standards are somewhat conflicting.
The HTML standard basically acknowledges that browsers typically
perform special rendering for anchors but makes no specification as
such. Under CSS, an anchor would be an inline element and so should
use the same text-decoration as its parent block. Assuming the default
as 'none', most browsers are technically wrong under CSS to render
anchors with an underline if the stylesheet is not explicitly set to
do so.

Is my understanding correct?

Reply With Quote
  #2  
Old   
dorayme
 
Posts: n/a

Default Re: Default anchor rendering, HTML vs CSS - 10-10-2009 , 09:21 PM






In article
<a78b54f3-0ec0-4157-bbcd-42a923ef2df0 (AT) o9g2000prg (DOT) googlegroups.com>,
yaugin <yaugin (AT) gmail (DOT) com> wrote:

Quote:
From HTML4:
User agents generally render links in such a way as to make them
obvious to users (underlining, reverse video, etc.). The exact
rendering depends on the user agent. Rendering may vary according to
whether the user has already visited the link or not.

From CSS2:
'text-decoration'
Value: none | [ underline || overline || line-through || blink ]
| inherit
Initial: none
Applies to: all elements
Inherited: no (see prose)
Percentages: N/A
Media: visual

This property describes decorations that are added to the text of an
element. If the property is specified for a block-level element, it
affects all inline-level descendants of the element. If it is
specified for (or affects) an inline-level element, it affects all
boxes generated by the element.

----

From my understanding, these two standards are somewhat conflicting.
The HTML standard basically acknowledges that browsers typically
perform special rendering for anchors but makes no specification as
such. Under CSS, an anchor would be an inline element and so should
use the same text-decoration as its parent block.
"should use" does not excludethat there may be an overriding style for
some text (e.g. a span or anchor) inside the container. And since CSS
default style sheets do make such overriding provisions for anchors,
there is no contradiction.

Quote:
Assuming the default
as 'none', most browsers are technically wrong under CSS to render
anchors with an underline if the stylesheet is not explicitly set to
do so.

Is my understanding correct?
--
dorayme

Reply With Quote
  #3  
Old   
Harlan Messinger
 
Posts: n/a

Default Re: Default anchor rendering, HTML vs CSS - 10-11-2009 , 01:35 AM



yaugin wrote:
Quote:
From HTML4:
User agents generally render links in such a way as to make them
obvious to users (underlining, reverse video, etc.). The exact
rendering depends on the user agent. Rendering may vary according to
whether the user has already visited the link or not.

From CSS2:
'text-decoration'
Value: none | [ underline || overline || line-through || blink ]
| inherit
Initial: none
Applies to: all elements
Inherited: no (see prose)
Percentages: N/A
Media: visual

This property describes decorations that are added to the text of an
element. If the property is specified for a block-level element, it
affects all inline-level descendants of the element. If it is
specified for (or affects) an inline-level element, it affects all
boxes generated by the element.

----

From my understanding, these two standards are somewhat conflicting.
The HTML standard basically acknowledges that browsers typically
perform special rendering for anchors but makes no specification as
such. Under CSS, an anchor would be an inline element and so should
use the same text-decoration as its parent block. Assuming the default
as 'none', most browsers are technically wrong under CSS to render
anchors with an underline if the stylesheet is not explicitly set to
do so.
"If the property is specified for a block-level element, it affects all
inline-level descendants of the element" doesn't mean "the browser style
sheet may not override the descendants' text-decoration value". It means
that if that value isn't *overridden* then it will apply to the block's
inline descendants. In other words, given an author style sheet

..a { text-decoration: overline; }

<div class="a">four <span class="b">score</span> and seven years ago</div>

the spec says that the word "score will have the same overline as the
rest of the div. It doesn't say that you aren't allowed to do add:

..b { text-decoration: none; }

If you do, it will be correct, and the overline should disappear over
the word "score".

The same principle holds for the browser's style sheet as for the
author's style sheet.

Reply With Quote
  #4  
Old   
C A Upsdell
 
Posts: n/a

Default Re: Default anchor rendering, HTML vs CSS - 10-11-2009 , 02:43 AM



yaugin wrote:
Quote:
From my understanding, these two standards are somewhat conflicting.
The HTML standard basically acknowledges that browsers typically
perform special rendering for anchors but makes no specification as
such. Under CSS, an anchor would be an inline element and so should
use the same text-decoration as its parent block. Assuming the default
as 'none', most browsers are technically wrong under CSS to render
anchors with an underline if the stylesheet is not explicitly set to
do so.

Is my understanding correct?
No. In many cases the CSS standards are silent regarding what the
default styles are. Each browser has a stylesheet which sets its
default styles, including default styles for anchors: since the CSS
standards do not prescribe a default appearance for anchors, the browser
is free to set any default it likes.

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

Default Re: Default anchor rendering, HTML vs CSS - 10-11-2009 , 04:16 AM



On 2009-10-11, yaugin <yaugin (AT) gmail (DOT) com> wrote:
Quote:
From HTML4:
User agents generally render links in such a way as to make them
obvious to users (underlining, reverse video, etc.). The exact
rendering depends on the user agent. Rendering may vary according to
whether the user has already visited the link or not.

From CSS2:
'text-decoration'
Value: none | [ underline || overline || line-through || blink ]
| inherit
Initial: none
Applies to: all elements
Inherited: no (see prose)
Percentages: N/A
Media: visual

This property describes decorations that are added to the text of an
element. If the property is specified for a block-level element, it
affects all inline-level descendants of the element. If it is
specified for (or affects) an inline-level element, it affects all
boxes generated by the element.

----

From my understanding, these two standards are somewhat conflicting.
The HTML standard basically acknowledges that browsers typically
perform special rendering for anchors but makes no specification as
such. Under CSS, an anchor would be an inline element and so should
use the same text-decoration as its parent block. Assuming the default
as 'none', most browsers are technically wrong under CSS to render
anchors with an underline if the stylesheet is not explicitly set to
do so.

Is my understanding correct?
Yes, but there's a subtlety here with the idea of the "default". The
_initial_ value of text-decoration is none. That's the value you get if
you don't get anything else from _any_ stylesheets.

But browsers implement much of HTML4 rendering rules with a "default
stylesheet". Typically that contains a rule like

:link { text-decoration:underline }

See Appendix D of CSS 2.1 for the suggested default stylesheet.

So even if there are no author stylesheets, links will be underlined. If
you turn off the default stylesheet, you will lose the underlining (and
also headings, paragraphs, list item bullets, in principle even tables
-- everything will just be display: inline, font-size: medium, etc.)

Reply With Quote
  #6  
Old   
dorayme
 
Posts: n/a

Default Re: Default anchor rendering, HTML vs CSS - 10-11-2009 , 06:05 AM



In article <slrnhd3543.9hl.spamspam (AT) bowser (DOT) marioworld>,
Ben C <spamspam (AT) spam (DOT) eggs> wrote:

Quote:
If
you turn off the default stylesheet, you will lose the underlining
Using FF View/page Style/No Style does not remove the underlining. Nor
via the normal Web Developer tools (like Disable Browser Default
Styles). Is the default stylesheet a towering hunk intimidating all and
everything that tries to shunt it aside. Not quite. It happily withdraws
in respect to many styles. But not the underlining. Perhaps link
underlining is hard coded into the browser somehow as default for
anchors but which can be overridden by CSS.

While the initial value of text-decoration is none, how does this speak
for whether *links* are underlined? The assumption that links naturally
take the initial value for text-decoration is perhaps neither right or
fraught by the assumption's preconditions.

Is there a way to return to the state of nature and see what HTML all on
its own can do? The closest we get is the styles the browser hard codes
into it when no actual stylesheet is operating. If so, is there a place
in the HTML specs that says that there is some extra primitive condition
for links that leaves them bare. I don't think so? I think OP quotes the
relevant bit and browsers maybe follow this (and *not necessarily*) via
style sheets.

Anyway, I don't know, I am speculating. How is one to test this
empirically?

--
dorayme

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

Default Re: Default anchor rendering, HTML vs CSS - 10-11-2009 , 08:19 AM



Ben C wrote:

Quote:
But browsers implement much of HTML4 rendering rules with a "default
stylesheet".
Or they just do as browsers have traditionally done, and you might be able
to describe this in terms of a fictitional default stylesheet. Modern
browsers might get closer to real browser stylesheets, but much of "browser
stylesheets" is just figurative speech.

Quote:
Typically that contains a rule like

:link { text-decoration:underline }

See Appendix D of CSS 2.1 for the suggested default stylesheet.
The "suggested" or "typical" stylesheet there (they didn't really decide
whether it's prescriptive or descriptive, and some parts thereof are just
nonsense) contains the rule

:link, :visited { text-decoration: underline }

Quote:
So even if there are no author stylesheets, links will be underlined.
If you turn off the default stylesheet, you will lose the underlining
(and also headings, paragraphs, list item bullets, in principle even
tables -- everything will just be display: inline, font-size: medium,
etc.)
Maybe you will, maybe you won't. Browsers existed for HTML documents before
CSS, too. They might thus fall back to pre-CSS rendering habits rather than
CSS-enabled rendering with default stylesheet ignores.

--
Yucca, http://www.cs.tut.fi/~jkorpela/

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

Default Re: Default anchor rendering, HTML vs CSS - 10-11-2009 , 09:35 AM



dorayme wrote:

Quote:
In article <slrnhd3543.9hl.spamspam (AT) bowser (DOT) marioworld>,
Ben C <spamspam (AT) spam (DOT) eggs> wrote:

If
you turn off the default stylesheet, you will lose the underlining

Using FF View/page Style/No Style does not remove the underlining.
I'm not surprised, since in my understanding, "Page style" refers to page
style sheets (= author style sheets), and "No style" simply means that no
page style sheet is applied.

Quote:
Nor via the normal Web Developer tools (like Disable Browser Default
Styles).
That's a different issue, but it's really about a browser add-on, rather
than the browser as such.

Quote:
Is the default stylesheet a towering hunk intimidating all
and everything that tries to shunt it aside. Not quite. It happily
withdraws in respect to many styles. But not the underlining. Perhaps
link underlining is hard coded into the browser somehow as default for
anchors but which can be overridden by CSS.
The link colors are preserved, too.

I wonder how it should be described in CSS terms, but anyway this seems to
depend on what is settable in Firefox browser settings. There (via the Tools
menu) you can set fonts etc. and also colors, including link colors, and
under colors (!), there's also a checkbox that determines whether links are
underlined.

What is a browser assumed to do in the absence of any stylesheet? Is it
allowed to do any formatting that is not directly set in HTML? Well, what is
the color of text, for example, or page background? A browser needs to have
_some_ default presentation for documents, even if it is black on white.
And, conceptually, one might say that the browser settings affect this
default presentation outside CSS. They create the basis, and then
stylesheets may modify things.

It's a bit more difficult to explain why removing all styles (Ctrl+Shift+S)
Web Developer Tools still leaves headings bold and big. Moreover, <strong>
is still bold and <em> is still italics. Well, conceptually, we need to
imply some default rendering for some elements on Firefox, even when style
sheets are disabled (in some sense), I guess.

--
Yucca, http://www.cs.tut.fi/~jkorpela/

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

Default Re: Default anchor rendering, HTML vs CSS - 10-11-2009 , 10:52 AM



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

But browsers implement much of HTML4 rendering rules with a "default
stylesheet".

Or they just do as browsers have traditionally done, and you might be able
to describe this in terms of a fictitional default stylesheet. Modern
browsers might get closer to real browser stylesheets, but much of "browser
stylesheets" is just figurative speech.
Well, one can't say for sure without looking at the source code.

One clue is which bits of CSS don't work (if display: table-cell or
counter-increment don't work then they probably aren't being used for
TDs and LIs).

But, corollarily, anything in Appendix D that does work probably _is_
being used-- If you've implemented support for display: table-cell
there's little point in not using it for TDs: you don't want two blobs
of code in your browser that are both supposed to do exactly the same
thing.

[...]
Quote:
So even if there are no author stylesheets, links will be underlined.
If you turn off the default stylesheet, you will lose the underlining
(and also headings, paragraphs, list item bullets, in principle even
tables -- everything will just be display: inline, font-size: medium,
etc.)

Maybe you will, maybe you won't. Browsers existed for HTML documents before
CSS, too. They might thus fall back to pre-CSS rendering habits rather than
CSS-enabled rendering with default stylesheet ignores.
I think unlikely (see above), although nothing would surprise me about
IE.

Reply With Quote
  #10  
Old   
dorayme
 
Posts: n/a

Default Re: Default anchor rendering, HTML vs CSS - 10-11-2009 , 07:49 PM



In article <TalAm.27230$La7.25751 (AT) uutiset (DOT) elisa.fi>,
"Jukka K. Korpela" <jkorpela (AT) cs (DOT) tut.fi> wrote:

Quote:
dorayme wrote:

....
... not the underlining. Perhaps
link underlining is hard coded into the browser somehow as default for
anchors but which can be overridden by CSS.

The link colors are preserved, too.

I wonder how it should be described in CSS terms, but anyway this seems to
depend on what is settable in Firefox browser settings.
....

The OP was wondering about conflicting standards between HTML and CSS
and the consensus here seems to be there is no real conflict. I agree
with this consensus. But the question about how the HTML "really ought
to default to" in the absence of default style sheets is either unclear
or not a good question.

Yes, there are user settable preferences, as you point out. We might
wonder what are the browser's default prefs, how is the browser shipped,
what if there were no "preferences" or "options" supplied and the bits
in the code for these things were taken out. Would there be underlining
or not? That could be overridden by CSS.

Too many counterfactuals! But if we did have a reasonable notion of the
modern browser in its native state, I would bet more money on the links
coming out underlined and probably in familiar colours and that this
would be simply a decision of the programmers with an eye on general
practice and:

"User agents generally render links in such a way as to make them
obvious to users (underlining, reverse video, etc.) ..."

--
dorayme

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 - 2009, Jelsoft Enterprises Ltd.