473,406 Members | 2,713 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,406 software developers and data experts.

Styling link underlines

JD
I've seen websites where the link underline is a different colour to the
link text. I've also seen links with dotted underlines (see the hover
effect on the 'Change' and 'All Microsoft Sites' links at the top right
of this page for an example: http://support.microsoft.com/kb/253503).

Do these techniques involve background image/border hacks or can it be
done by directly styling the underline using CSS?

Thanks
Nov 12 '08 #1
10 3126
On 2008-11-12, JD <us**@example.orgwrote:
I've seen websites where the link underline is a different colour to the
link text. I've also seen links with dotted underlines (see the hover
effect on the 'Change' and 'All Microsoft Sites' links at the top right
of this page for an example: http://support.microsoft.com/kb/253503).

Do these techniques involve background image/border hacks
Yes.
or can it be done by directly styling the underline using CSS?
No. You just get text-decoration: underline, which gives you a solid
line the same colour as the text.
Nov 12 '08 #2
Ben C schreef:
On 2008-11-12, JD <us**@example.orgwrote:
>I've seen websites where the link underline is a different colour to the
link text. I've also seen links with dotted underlines (see the hover
effect on the 'Change' and 'All Microsoft Sites' links at the top right
of this page for an example: http://support.microsoft.com/kb/253503).

Do these techniques involve background image/border hacks

Yes.
How do you tell?
>or can it be done by directly styling the underline using CSS?

No. You just get text-decoration: underline, which gives you a solid
line the same colour as the text.
You can do

a:hover {
color: yellow;
border-bottom: dotted;
}

Which is what the Microsoft seems to do to me. (with classes of course,
and also for :active and :focus).

Cheers, H.
--
Hendrik Maryns
http://tcl.sfs.uni-tuebingen.de/~hendrik/
==================
Ask smart questions, get good answers:
http://www.catb.org/~esr/faqs/smart-questions.html
Nov 12 '08 #3

Ben C wrote:
On 2008-11-12, JD <us**@example.orgwrote:
>I've seen websites where the link underline is a different colour to the
link text. I've also seen links with dotted underlines (see the hover
effect on the 'Change' and 'All Microsoft Sites' links at the top right
of this page for an example: http://support.microsoft.com/kb/253503).

Do these techniques involve background image/border hacks

Yes.
I wouldn't call using the border properties a hack, though, but an alternative to the text-decoration property.

--
Berg
Nov 12 '08 #4
On 2008-11-12, Hendrik Maryns <gt*******@sneakemail.comwrote:
Ben C schreef:
>On 2008-11-12, JD <us**@example.orgwrote:
>>I've seen websites where the link underline is a different colour to the
link text. I've also seen links with dotted underlines (see the hover
effect on the 'Change' and 'All Microsoft Sites' links at the top right
of this page for an example: http://support.microsoft.com/kb/253503).

Do these techniques involve background image/border hacks

Yes.

How do you tell?
I just know you can't do it with text-decoration. Therefore it must be
done some other way, and a border is the obvious one.
>>or can it be done by directly styling the underline using CSS?

No. You just get text-decoration: underline, which gives you a solid
line the same colour as the text.

You can do

a:hover {
color: yellow;
border-bottom: dotted;
}
Yes that sort of thing.
Nov 12 '08 #5
JD
Ben C wrote:
On 2008-11-12, Hendrik Maryns <gt*******@sneakemail.comwrote:
>Ben C schreef:
>>On 2008-11-12, JD <us**@example.orgwrote:
I've seen websites where the link underline is a different colour to the
link text. I've also seen links with dotted underlines (see the hover
effect on the 'Change' and 'All Microsoft Sites' links at the top right
of this page for an example: http://support.microsoft.com/kb/253503).

Do these techniques involve background image/border hacks
Yes.
How do you tell?

I just know you can't do it with text-decoration. Therefore it must be
done some other way, and a border is the obvious one.
>>>or can it be done by directly styling the underline using CSS?
No. You just get text-decoration: underline, which gives you a solid
line the same colour as the text.
You can do

a:hover {
color: yellow;
border-bottom: dotted;
}

Yes that sort of thing.
Can you put a border on an inline element like that?
Nov 12 '08 #6
Ben C schreef:
On 2008-11-12, Hendrik Maryns <gt*******@sneakemail.comwrote:
>Ben C schreef:
>>On 2008-11-12, JD <us**@example.orgwrote:
I've seen websites where the link underline is a different colour to the
link text. I've also seen links with dotted underlines (see the hover
effect on the 'Change' and 'All Microsoft Sites' links at the top right
of this page for an example: http://support.microsoft.com/kb/253503).

Do these techniques involve background image/border hacks
Yes.
How do you tell?

I just know you can't do it with text-decoration. Therefore it must be
done some other way, and a border is the obvious one.
>>>or can it be done by directly styling the underline using CSS?
No. You just get text-decoration: underline, which gives you a solid
line the same colour as the text.
You can do

a:hover {
color: yellow;
border-bottom: dotted;
}

Yes that sort of thing.
Ah, ok, I see, but I think it is a nice solution and wouldn’t call it a
hack either. There is a visible difference though: underline is closer
to the text than border (by default), since the border is below the
descenders, whereas the underline goes through them. You can see this
on the site the OP mentioned.

H.
--
Hendrik Maryns
http://tcl.sfs.uni-tuebingen.de/~hendrik/
==================
Ask smart questions, get good answers:
http://www.catb.org/~esr/faqs/smart-questions.html
Nov 12 '08 #7
On 2008-11-12, Hendrik Maryns <gt*******@sneakemail.comwrote:
Ben C schreef:
>On 2008-11-12, Hendrik Maryns <gt*******@sneakemail.comwrote:
>>Ben C schreef:
On 2008-11-12, JD <us**@example.orgwrote:
I've seen websites where the link underline is a different colour to the
link text. I've also seen links with dotted underlines (see the hover
effect on the 'Change' and 'All Microsoft Sites' links at the top right
of this page for an example: http://support.microsoft.com/kb/253503).
>
Do these techniques involve background image/border hacks
Yes.
How do you tell?

I just know you can't do it with text-decoration. Therefore it must be
done some other way, and a border is the obvious one.
>>>>or can it be done by directly styling the underline using CSS?
No. You just get text-decoration: underline, which gives you a solid
line the same colour as the text.
You can do

a:hover {
color: yellow;
border-bottom: dotted;
}

Yes that sort of thing.

Ah, ok, I see, but I think it is a nice solution and wouldn’t call it a
hack either.
I wouldn't either, but I suppose you could argue that it's a hack
because you're using a border to do underlining.
There is a visible difference though: underline is closer to the text
than border (by default), since the border is below the descenders,
whereas the underline goes through them. You can see this on the site
the OP mentioned.
Yes. The CSS specification doesn't define exactly where the bottom
border on an inline box goes, but most browsers put it at the font's
maximum descent. A bit too low for an underline really which usually
cuts through descenders.
Nov 12 '08 #8
On 2008-11-12, JD <us**@example.netwrote:
Ben C wrote:
>On 2008-11-12, Hendrik Maryns <gt*******@sneakemail.comwrote:
[...]
>>a:hover {
color: yellow;
border-bottom: dotted;
}

Yes that sort of thing.

Can you put a border on an inline element like that?
Yes there's no problem with that.
Nov 12 '08 #9
In article <6o************@mid.individual.net>,
Bergamot <be******@visi.comwrote:
Ben C wrote:
On 2008-11-12, JD <us**@example.orgwrote:
I've seen websites where the link underline is a different colour to the
link text. I've also seen links with dotted underlines (see the hover
effect on the 'Change' and 'All Microsoft Sites' links at the top right
of this page for an example: http://support.microsoft.com/kb/253503).

Do these techniques involve background image/border hacks
Yes.

I wouldn't call using the border properties a hack, though, but an
alternative to the text-decoration property.
A hack is relative to a task. If you just know someone used a hammer for
something or or other (but not what) under the bonnet of a car, a purist
mechanic would not disapprove. There are some things for which a hammer
on an engine is quite the right tool. But if he knew it was for driving
in an unimportant bolt (whose thread was damaged), he would raise an
eyebrow or wince. That raised eyebrow or that wince would mean, to those
who knew about these things, that the thread should be cleaned up (and
recut if necessary) and a spanner used.

If you cannot use text-decoration to underline a link to suit your
purpose, and you use border instead, there must be some slight, almost
imperceptible use of the muscles that operate the eyebrows or power a
wince.

It might be different for earthlings, some beings have logs that
register all 'muscle' activity, however slight.

--
dorayme
Nov 12 '08 #10
On 12 Nov, 14:36, JD <u...@example.orgwrote:
I've seen websites where the link underline is a different colour to the
link text. I've also seen links with dotted underlines (see the hover
effect on the 'Change' and 'All Microsoft Sites' links at the top right
of this page for an example:http://support.microsoft.com/kb/253503).
I am confused. What do an dotted underline means? To some users this
line looks exactly the same as the green dotted underline they are
using in their own help system.

Browsers are also rendering elements like abbr and acronym with a
dotted underline.

I don't think it is wise make your own conventions like that.
Do these techniques involve background image/border hacks or can it be
done by directly styling the underline using CSS?
On anchor links an solid underline is the convention.
Nov 13 '08 #11

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

Similar topics

11
by: SoloCDM | last post by:
What is needed to remove the underline in web page links? Do I need to change the color or is it something in the tag <a>? *********************************************************************...
5
by: Peter Collinson | last post by:
Hi... Is there any way to style a List Item a different color and size than the <LI> in an Ordered List? I'd like a red super-script number and a dark blue text in a page's footnotes. And...
6
by: Paul Kaufman | last post by:
What do I add to the style sheet to do this? Thanks. -Paul, the CSS Newbie
17
by: CJM | last post by:
....When I say 'form' I'm talking about a conventional paper version, as opposed to a <form>. I'm building a web-based application which needs to be able to create Invoices/Advice Notes/Order...
29
by: jmaxsherkimer | last post by:
the site we're working on has some anchor links, you click them they scroll to the bottom of the page with the answers to the questions linked on to. is there anyway to make it so that the links...
4
by: Mr. Newt | last post by:
Hi y'all, I'm looking to put an underline under some links but not under others. I still want an underline when the link is hovered over. I've dabbled with classes for this, but all I can get...
3
by: nicky77 | last post by:
Hi, before you say it i know frames are bad practice - but i'm developing dynamic content on a site which has already been designed, so alas there's no option but to use them. Anyway, I just want to...
7
by: Jeff Gaines | last post by:
I have spent the day learning how to use Zend Development Environment. I can now produce a list of files in a directory, filtered by extension, and apparently clickable. Unfortunately clicking on...
3
by: mcfly1204 | last post by:
I have an image link, an image within an anchor tag, that I would like to remove the styling of. When I say styling, I mean the default blue box around the image. I have tried: text-decoration:...
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: 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...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
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
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
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,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

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.