[Webinar] Streamline your web hosting managementRegister Today

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 468
  • Last Modified:

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;
0
SunScreenCert
Asked:
SunScreenCert
  • 3
  • 2
  • 2
1 Solution
 
aconradCommented:
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
 
SunScreenCertAuthor Commented:
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
 
aconradCommented:

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
Never miss a deadline with monday.com

The revolutionary project management tool is here!   Plan visually with a single glance and make sure your projects get done.

 
David S.Commented:
You could give the h1 display:inline or float:left to make it only as wide as needed.
0
 
SunScreenCertAuthor Commented:
i don't want to add php code right now
0
 
SunScreenCertAuthor Commented:
how to do it using display:inline
0
 
David S.Commented:
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

[Webinar] Kill tickets & tabs using PowerShell

Are you tired of cycling through the same browser tabs everyday to close the same repetitive tickets? In this webinar JumpCloud will show how you can leverage RESTful APIs to build your own PowerShell modules to kill tickets & tabs using the PowerShell command Invoke-RestMethod.

  • 3
  • 2
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now