Connecting Tech Pros Worldwide Help | Site Map

text decoration inheritance

Andrew Tang
Guest
 
Posts: n/a
#1: Jul 20 '05
Hi, I need some help with understanding this piece of css.

<u>This is a <a href="#" style="text-decoration:none;">hyperlink</a> with
surrounding underlining</u>

From what I understand of css, the styling in <a> should override its
parent. But it doesnt seem to work in this case, the whole sentence is still
underlined even though I have specifically specified no text-decoration. I'm
not saying its wrong but I really cant get my head around to why this is -
is this a case exception?

Btw, this only happens with Gekko (Mozilla) and Opera which follows the W3c
recommednation properly. IE6 seems to render it as I would have expected
(with hyperlinks anyway).

Much appreciated,
Andy


Philipp Lenssen
Guest
 
Posts: n/a
#2: Jul 20 '05

re: text decoration inheritance


Andrew Tang wrote:
[color=blue]
>
> <u>This is a <a href="#" style="text-decoration:none;">hyperlink</a>
> with surrounding underlining</u>
>[/color]

Do not use inline-styles!
Instead, use:
a:link, a:visited etc. { text-decoration... }

When you turn off text-decoration, make sure to find a good replacement
(like setting the link-color... and setting the back-color).

Does that solve your problems?


--
Google Blogoscoped
http://blog.outer-court.com
Johannes Koch
Guest
 
Posts: n/a
#3: Jul 20 '05

re: text decoration inheritance


Philipp Lenssen wrote:[color=blue]
> Andrew Tang wrote:
>
>[color=green]
>><u>This is a <a href="#" style="text-decoration:none;">hyperlink</a>
>>with surrounding underlining</u>[/color]
> When you turn off text-decoration, make sure to find a good replacement
> (like setting the link-color... and setting the back-color).[/color]

Additionally, don't underline text, which is no link.
--
Johannes Koch
In te domine speravi; non confundar in aeternum.
(Te Deum, 4th cent.)

Philipp Lenssen
Guest
 
Posts: n/a
#4: Jul 20 '05

re: text decoration inheritance


Johannes Koch wrote:
[color=blue]
> Philipp Lenssen wrote:[color=green]
> > Andrew Tang wrote:[color=darkred]
> > > >><u>This is a <a href="#"
> > > style="text-decoration:none;">hyperlink</a>
> >>with surrounding underlining</u>[/color]
> > When you turn off text-decoration, make sure to find a good
> > replacement (like setting the link-color... and setting the
> > back-color).[/color]
>
> Additionally, don't underline text, which is no link.[/color]

Absolutely. The only need for that would be as a reminder in
development stage that this should be a link. Everything that goes live
on the Web should not have underlines for none-links. And then there's
some websites which exactly reverse this approach... oh well.


--
Google Blogoscoped
http://blog.outer-court.com
Stephen Poley
Guest
 
Posts: n/a
#5: Jul 20 '05

re: text decoration inheritance


On Thu, 25 Sep 2003 12:40:52 +0100, "Andrew Tang"
<Andy_Tang2k@hotmail.com> wrote:
[color=blue]
>Hi, I need some help with understanding this piece of css.
>
><u>This is a <a href="#" style="text-decoration:none;">hyperlink</a> with
>surrounding underlining</u>
>
>From what I understand of css, the styling in <a> should override its
>parent. But it doesnt seem to work in this case, the whole sentence is still
>underlined even though I have specifically specified no text-decoration. I'm
>not saying its wrong but I really cant get my head around to why this is -
>is this a case exception?
>
>Btw, this only happens with Gekko (Mozilla) and Opera which follows the W3c
>recommednation properly. IE6 seems to render it as I would have expected
>(with hyperlinks anyway).[/color]

The effect of switching underlining (or anything else) on in HTML and
off in CSS is AFAIK undefined, and consequently browser-dependent. If
you want consistency, use CSS throughout and don't use the HTML <U>
element.

--
Stephen Poley

http://www.xs4all.nl/~sbpoley/webmatters/
Andrew Tang
Guest
 
Posts: n/a
#6: Jul 20 '05

re: text decoration inheritance


"Philipp Lenssen" <info@outer-court.com> wrote in message
news:bkulpr$64q17$1@ID-203055.news.uni-berlin.de...[color=blue]
> Andrew Tang wrote:
>[color=green]
> >
> > <u>This is a <a href="#" style="text-decoration:none;">hyperlink</a>
> > with surrounding underlining</u>
> >[/color]
>
> Do not use inline-styles!
> Instead, use:
> a:link, a:visited etc. { text-decoration... }
>
> When you turn off text-decoration, make sure to find a good replacement
> (like setting the link-color... and setting the back-color).[/color]

Sorry about the code, its the 'shorten version' so the page does clearly
define what a hyperlink is and is not. The problem with Mozilla and Opera
(which uses the w3c standard) is that 'Text-decoration: none' does nothing
when the parent has 'text-decoration:underline' (which is <u> in this case)
so it doesnt matter if it is inlined or not.

I just dont see why that is, when attributes such as 'background-color',
'color' and 'font-family' does exactly what it suppose to do whereelse
'text-decoration' follows its own rules!

Andy


Andrew Tang
Guest
 
Posts: n/a
#7: Jul 20 '05

re: text decoration inheritance



"Stephen Poley" <sbpoley@xs4all.nl> wrote in message
news:opo5nvkhnsq0qfrm9kf442f87mqbhs13i4@4ax.com...[color=blue]
> On Thu, 25 Sep 2003 12:40:52 +0100, "Andrew Tang"
> <Andy_Tang2k@hotmail.com> wrote:
>[color=green]
> >
> ><u>This is a <a href="#" style="text-decoration:none;">hyperlink</a> with
> >surrounding underlining</u>[/color]
>
> The effect of switching underlining (or anything else) on in HTML and
> off in CSS is AFAIK undefined, and consequently browser-dependent. If
> you want consistency, use CSS throughout and don't use the HTML <U>
> element.
>[/color]

Thanks for you answer but that isnt the problem. The code I given out is the
shorten version, I could have easily written:

<span style="text-decoration:underline;">This is a <a href="#"
style="text-decoration:none;">hyperlink</a> with surrounding
underling</span>

and it still faces the same problem. The hyperlink is -still- underlined
even though I specifically said none so I assume its inheriting for some
reason. I'm trying to make w3c compliant code, thats why I dont understand
why Mozilla and Opera is doing this - so I'm just trying to understand it.

Andy


Andreas Prilop
Guest
 
Posts: n/a
#8: Jul 20 '05

re: text decoration inheritance


On Thu, 25 Sep 2003, Johannes Koch wrote:
[color=blue]
> Additionally, don't underline text, which is no link.[/color]

This is a strange idea. Underlining is a valid typographic procedure
that is much older than hyperlinks; underline =|= link.

For example, I need <u>s</u> and <u>z</u> in
http://www.unics.uni-hannover.de/nhtcapri/arabic.html6

Philipp Lenssen
Guest
 
Posts: n/a
#9: Jul 20 '05

re: text decoration inheritance


Andreas Prilop wrote:
[color=blue]
> On Thu, 25 Sep 2003, Johannes Koch wrote:
>[color=green]
> > Additionally, don't underline text, which is no link.[/color]
>
> This is a strange idea. Underlining is a valid typographic procedure
> that is much older than hyperlinks; underline =|= link.
>[/color]

A valid typographic procedure on _paper_. And in many other digital
systems. Even in my email client. It is absolutely not common for
non-links on the Web, and highly confusing. Many metaphors or
approaches for offline-media won't work online. (By the way, this alone
doesn't mean you may _never_ have reason not to underline non-links.)

--
Google Blogoscoped
http://blog.outer-court.com
Jim Dabell
Guest
 
Posts: n/a
#10: Jul 20 '05

re: text decoration inheritance


Andrew Tang wrote:
[color=blue]
> Hi, I need some help with understanding this piece of css.
>
> <u>This is a <a href="#" style="text-decoration:none;">hyperlink</a> with
> surrounding underlining</u>
>
> From what I understand of css, the styling in <a> should override its
> parent. But it doesnt seem to work in this case, the whole sentence is
> still underlined even though I have specifically specified no
> text-decoration. I'm not saying its wrong but I really cant get my head
> around to why this is - is this a case exception?[/color]
[snip]

Sort of. Text decoration applies to the whole element including its
children - so the value isn't inherited (and therefore cannot be
overridden) - but still has effect.

The CSS 2 specification isn't very clear on this:

<URL:http://www.w3.org/TR/REC-CSS2/text.html#lining-striking-props>

However, the CSS 2.1 draft clarifies things, and I believe Mozilla has been
attempting to comply with that recently.

"Text decorations on inline boxes are drawn across the entire element, going
across any descendant elements without paying any attention to their
presence."

-- <URL:http://www.w3.org/TR/CSS21/text.html#lining-striking-props>


--
Jim Dabell

Andreas Prilop
Guest
 
Posts: n/a
#11: Jul 20 '05

re: text decoration inheritance


"Philipp Lenssen" <info@outer-court.com> wrote:
[color=blue]
> By the way, this alone
> doesn't mean you may _never_ have reason not to underline non-links.[/color]
^^^ ^^^^^ ^^^ ^^^
I give up! Think and write positive!

--
http://www.google.com/search?q=%22Quadruple+Negative%22
Philipp Lenssen
Guest
 
Posts: n/a
#12: Jul 20 '05

re: text decoration inheritance


Andreas Prilop wrote:
[color=blue]
> "Philipp Lenssen" <info@outer-court.com> wrote:
>[color=green]
> > By the way, this alone
> > doesn't mean you may never have reason not to underline non-links.[/color]
> ^^^ ^^^^^ ^^^ ^^^
> I give up! Think and write positive![/color]

I'm a very positive guy, so here's the translation:

"By the way, there might be some reason to sometimes underline normal
text (but let's get into that sometime else, 'cause you'll always find
an exception to the rule)."


--
Google Blogoscoped
http://blog.outer-court.com
Andrew Tang
Guest
 
Posts: n/a
#13: Jul 20 '05

re: text decoration inheritance



"Jim Dabell" <jim-usenet@jimdabell.com> wrote in message
news:cbCdnVQn1ceYhu6iRVn-ig@giganews.com...[color=blue]
>
> Sort of. Text decoration applies to the whole element including its
> children - so the value isn't inherited (and therefore cannot be
> overridden) - but still has effect.
>
> "Text decorations on inline boxes are drawn across the entire element,[/color]
going[color=blue]
> across any descendant elements without paying any attention to their
> presence."
>[/color]

Thanks for that, does anyone knows why this decision was made? Its seems
kind of unusual. If a parent has underline, there is no way to get rid of
it. Bolds and Italic doesnt work the way underline does. Do you think its
something to do with hyperlinks default format as they are underlined.

Andy


kchayka
Guest
 
Posts: n/a
#14: Jul 20 '05

re: text decoration inheritance


Andrew Tang wrote:[color=blue]
>
> something to do with hyperlinks default format as they are underlined.[/color]

FYI, links are not underlined by default in either CSS or HTML.

Take a gander at your browser preferences. Chances are, you'll find an
option somewhere that sets underlining default.

--
To email a reply, remove (dash)un(dash). Mail sent to the un
address is considered spam and automatically deleted.

Andrew Tang
Guest
 
Posts: n/a
#15: Jul 20 '05

re: text decoration inheritance


"kchayka" <kcha-un-yka@sihope.com> wrote in message
news:3f7439d9$1@news.sihope.com...[color=blue]
> Andrew Tang wrote:[color=green]
> >
> > something to do with hyperlinks default format as they are underlined.[/color]
>
> FYI, links are not underlined by default in either CSS or HTML.
>
> Take a gander at your browser preferences. Chances are, you'll find an
> option somewhere that sets underlining default.[/color]

You are correct. I never noticed that before cause I thought it was a
standard for links to be underlined blue since Mozilla, Opera and IE6 all
does this - but they also have options to change this.

Andy


Closed Thread


Similar HTML / CSS bytes