# Trivial CSS link underlining question

**URL:** https://boards.straightdope.com/t/trivial-css-link-underlining-question/111147
**Category:** Factual Questions
**Created:** [May 28, 2002, 8:04am UTC](https://boards.straightdope.com/t/trivial-css-link-underlining-question/111147 "2002-05-28T08:04:40Z")
**Posts on this page:** 9
**Page:** 1

<div class="post-metadata">

### Author: ![Crusoe](https://avatars.discourse-cdn.com/v4/letter/c/49beb7/32.png) [@Crusoe](https://boards.straightdope.com/u/Crusoe)
#### Post date: [May 28, 2002, 8:04am UTC](https://boards.straightdope.com/t/trivial-css-link-underlining-question/111147/1 "2002-05-28T08:04:40Z")

</div>

I know how to use CSS to change the **text-decoration** property and otherwise customise **.hover** characteristics. What I’d like to do is remove the gap between the underline and the link text – that gap of a pixel or two – and I’m convinced I’ve seen this on a handful of websites.

How is it done?

---

<div class="post-metadata">

### Author: ![London\_Calling](https://avatars.discourse-cdn.com/v4/letter/l/49beb7/32.png) [@London\_Calling](https://boards.straightdope.com/u/London_Calling)
#### Post date: [May 28, 2002, 10:41am UTC](https://boards.straightdope.com/t/trivial-css-link-underlining-question/111147/2 "2002-05-28T10:41:50Z")

</div>

If I understand you, Matt, I thought having no gap was pretty much the default (like on this page) ? Having siad that, I have little more than a working knowledge myself.

BTW, as you like a clean look, aren’t you tempted to remove the line altogether and just have hover ?

---

<div class="post-metadata">

### Author: ![Crusoe](https://avatars.discourse-cdn.com/v4/letter/c/49beb7/32.png) [@Crusoe](https://boards.straightdope.com/u/Crusoe)
#### Post date: [May 28, 2002, 10:59am UTC](https://boards.straightdope.com/t/trivial-css-link-underlining-question/111147/3 "2002-05-28T10:59:23Z")

</div>

There’s usually a gap of about a pixel or two between the bottom of the non-hanging characters in links and the underline (when links are underlined – I normally switch that off through Opera). I’m sure I’ve seen sites that have the underline flush with the bottom of non-hanging characters, but I’m buggered if I know how to do it.

I’ve tried fiddling with **margin-bottom** , **padding** and even replacing **text-decoration:underline** with **border-bottom:(etc)**, but nothing works. It’s only a trivial thing, but I’d like to know how it’s done.

I currently have the ‘clean’ look, but quite like this alternative form of underlining. Just curious, really, and I dislike not being able to work something out like that.

---

<div class="post-metadata">

### Author: ![Crusoe](https://avatars.discourse-cdn.com/v4/letter/c/49beb7/32.png) [@Crusoe](https://boards.straightdope.com/u/Crusoe)
#### Post date: [May 28, 2002, 11:00am UTC](https://boards.straightdope.com/t/trivial-css-link-underlining-question/111147/4 "2002-05-28T11:00:54Z")

</div>

That should have been **border-bottom : ( etc )**, but I forgot to disable smilies.

---

<div class="post-metadata">

### Author: ![jjimm](https://avatars.discourse-cdn.com/v4/letter/j/ba8739/32.png) [@jjimm](https://boards.straightdope.com/u/jjimm)
#### Post date: [May 28, 2002, 11:02am UTC](https://boards.straightdope.com/t/trivial-css-link-underlining-question/111147/5 "2002-05-28T11:02:43Z")

</div>

I’ve been using CSS for 'kin years, and I’ve never heard of this phenomenon, nor seen it. I’d imagine it’s a properly of the font used, rather than a stylesheet property.

---

<div class="post-metadata">

### Author: ![Crusoe](https://avatars.discourse-cdn.com/v4/letter/c/49beb7/32.png) [@Crusoe](https://boards.straightdope.com/u/Crusoe)
#### Post date: [May 28, 2002, 11:04am UTC](https://boards.straightdope.com/t/trivial-css-link-underlining-question/111147/6 "2002-05-28T11:04:47Z")

</div>

Bugger. I’m now starting to suspect that. I recently installed Lucida Grande, and when I use it as the icon font in Windows, it creates the flush underline effect I want. When I use any other font (say Tahoma) the underline is ‘padded’ as normal.

Oh well. Ta anyway!

---

<div class="post-metadata">

### Author: ![Crusoe](https://avatars.discourse-cdn.com/v4/letter/c/49beb7/32.png) [@Crusoe](https://boards.straightdope.com/u/Crusoe)
#### Post date: [May 28, 2002, 11:05am UTC](https://boards.straightdope.com/t/trivial-css-link-underlining-question/111147/7 "2002-05-28T11:05:50Z")

</div>

Sorry. The Windows underlining occurs in Windows Explorer, on mouseover in the left-hand pane (in case I confused anyone).

---

<div class="post-metadata">

### Author: ![London\_Calling](https://avatars.discourse-cdn.com/v4/letter/l/49beb7/32.png) [@London\_Calling](https://boards.straightdope.com/u/London_Calling)
#### Post date: [May 28, 2002, 11:18am UTC](https://boards.straightdope.com/t/trivial-css-link-underlining-question/111147/8 "2002-05-28T11:18:02Z")

</div>

Well, if it can be done in CSS1 or 2, I don’t know about it. An alternative would be simple graphic buttons - image swap 'em ?

---

<div class="post-metadata">

### Author: ![Crusoe](https://avatars.discourse-cdn.com/v4/letter/c/49beb7/32.png) [@Crusoe](https://boards.straightdope.com/u/Crusoe)
#### Post date: [May 28, 2002, 11:21am UTC](https://boards.straightdope.com/t/trivial-css-link-underlining-question/111147/9 "2002-05-28T11:21:19Z")

</div>

Nah. I’m trying to keep it simple with text links and minimal use of images. I’m trying to replace image rollovers with plain non-graphic CSS-based ones (I love CSS at the moment!).
