473,395 Members | 1,941 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,395 software developers and data experts.

text decoration inheritance

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
Jul 20 '05 #1
14 6321
Andrew Tang wrote:

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


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
Jul 20 '05 #2
Philipp Lenssen wrote:
Andrew Tang wrote:

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

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


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

Jul 20 '05 #3
Johannes Koch wrote:
Philipp Lenssen wrote:
Andrew Tang wrote:
>><u>This is a <a href="#"
style="text-decoration:none;">hyperlink</a>
with surrounding underlining</u>

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


Additionally, don't underline text, which is no link.


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
Jul 20 '05 #4
On Thu, 25 Sep 2003 12:40:52 +0100, "Andrew Tang"
<An*********@hotmail.com> wrote:
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).


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/
Jul 20 '05 #5
"Philipp Lenssen" <in**@outer-court.com> wrote in message
news:bk************@ID-203055.news.uni-berlin.de...
Andrew Tang wrote:

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


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).


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
Jul 20 '05 #6

"Stephen Poley" <sb*****@xs4all.nl> wrote in message
news:op********************************@4ax.com...
On Thu, 25 Sep 2003 12:40:52 +0100, "Andrew Tang"
<An*********@hotmail.com> wrote:

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


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.


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
Jul 20 '05 #7
On Thu, 25 Sep 2003, Johannes Koch wrote:
Additionally, don't underline text, which is no link.


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

Jul 20 '05 #8
Andreas Prilop wrote:
On Thu, 25 Sep 2003, Johannes Koch wrote:
Additionally, don't underline text, which is no link.


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


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
Jul 20 '05 #9
Andrew Tang wrote:
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?

[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

Jul 20 '05 #10
"Philipp Lenssen" <in**@outer-court.com> wrote:
By the way, this alone
doesn't mean you may _never_ have reason not to underline non-links.

^^^ ^^^^^ ^^^ ^^^
I give up! Think and write positive!

--
http://www.google.com/search?q=%22Quadruple+Negative%22
Jul 20 '05 #11
Andreas Prilop wrote:
"Philipp Lenssen" <in**@outer-court.com> wrote:
By the way, this alone
doesn't mean you may never have reason not to underline non-links.

^^^ ^^^^^ ^^^ ^^^
I give up! Think and write positive!


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
Jul 20 '05 #12

"Jim Dabell" <ji********@jimdabell.com> wrote in message
news:cb********************@giganews.com...

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, going across any descendant elements without paying any attention to their
presence."


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
Jul 20 '05 #13
Andrew Tang wrote:

something to do with hyperlinks default format as they are underlined.


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.

Jul 20 '05 #14
"kchayka" <kc*********@sihope.com> wrote in message
news:3f********@news.sihope.com...
Andrew Tang wrote:

something to do with hyperlinks default format as they are underlined.


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.


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
Jul 20 '05 #15

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
by: Quinton | last post by:
I'm running a website that uses CSS to format the text and a CGI program Coranto that icludes news updates via SSI. My problem is that some parts of the CSS don't seem to take effect on the...
3
by: Christian Roth | last post by:
What I want: <p style="text-decoration: line-through"> Stricken <span style="text-decoration: none">not stricken</span> </p> , where "Stricken " should be the only thing that is lined...
2
by: george.leithead | last post by:
Hi all, I have a very strange problem! In following Web page (which is generated from a CMS System), the navigation to the left 'dissapears' when you roll the mouse over the links? It does not...
12
by: tim | last post by:
I am using foldoutmenu 3 and am having problems with viewing my menus in firefox. On my sub3 menus i have more than one line of text in some places. firefox does not recognise that there is more...
13
by: =?Utf-8?B?S2VzdGZpZWxk?= | last post by:
Hi Our company has a .Net web service that, when called via asp.net web pages across our network works 100%! The problem is that when we try and call the web service from a remote machine, one...
2
by: Francesco Moi | last post by:
Hi. I want to create a link within a H1 text: --- <h1><a href=foo>text</a></h1> --- And I've got (in my CSS) --- h1
7
by: pbd22 | last post by:
Hi. Can somebody tell me how I would go about allowing the user to click on a link to put content in text box A and then another link to put different content in text box A and so on. Finally,...
2
by: GloStix | last post by:
For some reason, FF likes to put a black underline on all my buttons. No matter what I do, it has the line I've tried displaying as block and cursor, anything.. Also I've been trying to get it so...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.