Link to home
Create AccountLog in
Avatar of Pete Winter
Pete WinterFlag for United Kingdom of Great Britain and Northern Ireland

asked on

Inline hover

<a href="#" style="text-decoration: underline;">Text</a>

See my above code.

How do I add an hover effect by using inline code?

I want the hover to be style="text-decoration: none;"
Avatar of Robert Granlund
Robert Granlund
Flag of United States of America image

Create a style in the css:

.link  a{
text-decoration:none;
}

.link  a:hover{
text-decoration:underline;
}

THEN:
<a href="#" class="link">Text</a>
Avatar of CaptRespect
CaptRespect

use a bit of css
<style>

a:hover {
text-decoration: none;
}

</style>

Open in new window

Avatar of Pete Winter

ASKER

Thanks. I understand it can be done that way, but can it be done as the inline style supplied? I don't want to refer to a separate piece off css.
ASKER CERTIFIED SOLUTION
Avatar of LZ1
LZ1
Flag of United States of America image

Link to home
membership
Create an account to see this answer
Signing up is free. No credit card required.
Create Account
Place this in the head:
<style>
.link a {
      text-decoration:underline;
}

.link a:hover      {
      text decoration:none;
}
</style>

Place this in the body:
<a href="test.php" class="link">test me!</a>
Or in the CSS section on page as rgranlund pointed out. ;)
Thanks for clarifying that for me.