?
Solved

css text-decoration:underline

Posted on 2009-05-06
7
Medium Priority
?
460 Views
Last Modified: 2012-05-06
i underline a text in css like this
h1{
      text=decoration: underline;
}
but how do i set the color  and size of the underline just like we have these properties for border-bottom
border-bottom: 1px solid gray;
0
Comment
Question by:SunScreenCert
[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
  • 3
  • 2
  • 2
7 Comments
 
LVL 4

Expert Comment

by:aconrad
ID: 24321674
You use border to change the underline.
You can use hover to change colors for mouse over/out

http://www.hyperlinkcode.com/change-underline-color.php
:
<a href="change-underline-color.php" style="text-decoration: none; border-bottom: 1px solid #999999">change underline color</a>
0
 
LVL 2

Author Comment

by:SunScreenCert
ID: 24321891
But if i use border, it creates a border across the whole width of the screen and text-decoration  creates only below the text, so i cannot use border here
0
 
LVL 4

Expert Comment

by:aconrad
ID: 24321997

This code doesnt do a border across the whole width of the screen :

<a href="change-underline-color.php" style="text-decoration: none; border-bottom: 1px solid #999999">change underline color</a>
0
7 Extremely Useful Linux Commands for Beginners

Just getting started with Linux? Here's a quick start guide that has 7 commands that we believe will come in handy.

 
LVL 42

Accepted Solution

by:
David S. earned 200 total points
ID: 24322039
You could give the h1 display:inline or float:left to make it only as wide as needed.
0
 
LVL 2

Author Comment

by:SunScreenCert
ID: 24322106
i don't want to add php code right now
0
 
LVL 2

Author Comment

by:SunScreenCert
ID: 24322108
how to do it using display:inline
0
 
LVL 42

Expert Comment

by:David S.
ID: 24322199
aconrad said nothing about using PHP. He just linked to an example.

Try this:
h1{
  display: inline;
  border-bottom: 1px solid #999999;
}

Open in new window

0

Featured Post

On Demand Webinar - Networking for the Cloud Era

This webinar discusses:
-Common barriers companies experience when moving to the cloud
-How SD-WAN changes the way we look at networks
-Best practices customers should employ moving forward with cloud migration
-What happens behind the scenes of SteelConnect’s one-click button

Question has a verified solution.

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

CSS is a visual language used to classify objects and define rules about how they should be displayed. CSS skills aren’t restricted to developers anymore, there is a big benefit to having a basic understanding of the language, regardless of your occ…
Originally, this post was published on Monitis Blog, you can check it here . In business circles, we sometimes hear that today is the “age of the customer.” And so it is. Thanks to the enormous advances over the past few years in consumer techno…
In this tutorial viewers will learn how to style a decorative dropcap for the first letter in a paragraph using CSS. In CSS, create a new paragraph class by typing "p.fancy": Then, to style only the first letter of the first sentence, include the ps…
In this tutorial viewers will learn how to embed custom externally-hosted Google Fonts using the Google Font API in CSS Go to the Google Fonts website at google.com/fonts: Browse or search based on font properties or name to find a suitable font for…
Suggested Courses

765 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