?
Solved

Advanced Link Underlines in CSS

Posted on 2005-03-02
5
Medium Priority
?
373 Views
Last Modified: 2006-11-17
Curious if I can do either of the following with CSS?

1.) Make a link blue, but have the underline red?  (different colors for the link text and link underline.)

2.) Make the spacing between the text different than normal.  So I would have the text, and instead of the underline where it normally is have the underline say 10 px, or 15 px below the text?

Thanks.  I’m not a CSS expert and have no idea if these are possible.  I'm sure even if not directly possible with CSS that there could be some workaround to get these features working.

Andrew
0
Comment
Question by:rebies
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 4
5 Comments
 
LVL 30

Expert Comment

by:GrandSchtroumpf
ID: 13443029
> 1.) Make a link blue, but have the underline red?  (different colors for the link text and link underline.)
no, but you can use blue text with a red bottom border, which will have a similar effect.

> 2.) Make the spacing between the text different than normal.  So I would have the text, and instead of the underline where it normally is have the underline say 10 px, or 15 px below the text?
this can also be done with a border.  just specify a bottom padding for your text and the bottom border will be shifted down.
0
 
LVL 30

Accepted Solution

by:
GrandSchtroumpf earned 2000 total points
ID: 13443113
here is an example:


<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html>
<head>
<title>Untitled Document</title>
<link href="style/style.css" rel="stylesheet" type="text/css" />

<style type="text/css">

div {
  line-height: 2em;
}
a {
  color: blue;
  border-bottom: 2px solid red;
  padding-bottom: .3em;
  text-decoration: none;
}

</style>

</head>

<body>

<div>
Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Nulla rhoncus vehicula nisl. Duis eleifend ante a lorem. Quisque non nulla sed ante aliquam porttitor. Pellentesque habitant morbi tristique senectus et netus et malesuada fames ac turpis egestas. Quisque posuere dolor eu lorem.

<a href="www.google.com">www.google.com</a>

Integer et est sit amet enim porttitor tristique. Suspendisse nec nisl. Duis pellentesque. Proin ultricies. Maecenas pharetra suscipit eros. Fusce fermentum imperdiet nunc. Pellentesque habitant morbi tristique senectus et netus et malesuada fames ac turpis egestas. Integer rutrum enim eu risus.
</div>

</body>
</html>
0
 
LVL 30

Expert Comment

by:GrandSchtroumpf
ID: 13443132
note that you can remove the following line:
<link href="style/style.css" rel="stylesheet" type="text/css" />
i forgot to delete it.
0
 
LVL 1

Author Comment

by:rebies
ID: 13444654
GrandSchtroumpf:

Sorry I did not respond earlier!  Thanks so much!  That is exactly what I was looking for.  So very cool!

A+++

Andrew
0
 
LVL 30

Expert Comment

by:GrandSchtroumpf
ID: 13444806
<:°)
0

Featured Post

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Unordered lists (HTML ul tags) are very handy to create menus of all types, shapes and sizes.  All it takes is a little knowledge of CSS and the possibilities are endless. First off, you should know the general format for menus created using the …
CSS3 Custom checkboxes This article shows how to style the checkbox form element using only CSS. Works in: Chrome, FF, Safari, Opera, IE9+ Uses modernizr.js to check for :checked pseudo class, falling back to plain old checkboxes (IE8 and bel…
In this tutorial viewers will learn how to style transparent/translucent elements using alpha transparency in CSS Start with a normal styled element, such as a div.: Define its "background-color" property as "rgba (255, 255, 255, .5): The numbers in…
The viewer will learn the benefit of using external CSS files and the relationship between class and ID selectors. Create your external css file by saving it as style.css then set up your style tags: (CODE) Reference the nav tag and set your prop…
Suggested Courses
Course of the Month8 days, 13 hours left to enroll

764 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question