-1

What I want it to only perform -

a:hover {
background-color: #3b3b3b;
color: #d402d4;
}

with anything in a class.

I'll show an example excerpt of my code to help you better understand.

<a href="website2.html">
    <img alt="name" src="image.url" width=32" height="32">
    <br>
    <small>Name</small>
</a>

I only want -

a:hover {
background-color: #3b3b3b;
color: #d402d4;
}

to apply to <small>Name</small> but not <img alt="name" src="image.url" width=32" height="32">. My idea was to add a class to <small class="class1">Name</small>, and only perform a:hover { on that class. I am not sure if this is possible or if there is a more simpler way?

corn on the cob
  • 2,093
  • 3
  • 18
  • 29

2 Answers2

1

You can do:

a:hover small {
    background-color: #3b3b3b;
    color: #d402d4;
}

or add a class in your small tag (recomended):

a:hover .your-small-class {
    background-color: #3b3b3b;
    color: #d402d4;
}

That way, when you hover the a tag, just the .class properties will change.

0

Do you mean a:hover small { ... }, a:hover .class1 { ... } or something like this?

ΔO 'delta zero'
  • 3,506
  • 1
  • 19
  • 31