Link to home
Start Free TrialLog in
Avatar of SunScreenCert
SunScreenCert

asked on

css text-decoration:underline

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;
Avatar of aconrad
aconrad

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>
Avatar of SunScreenCert

ASKER

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

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>
ASKER CERTIFIED SOLUTION
Avatar of David S.
David S.
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
i don't want to add php code right now
how to do it using display:inline
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