user348173 user348173 - 2 years ago 172
HTML Question

Clickable icon and text inside li

I have a icon and text besides icon. I made icon clickable, but can't make text also be clickable. It seems simple, but I've tried different ways and can't make it work.


Answer Source

Use cursor: pointer; on the span element ;)

The issue is that the a element (which has cursor: pointer; property by default does not contain the text which is on the span element)


As said @Justinas, it will not trigger the link that way. So you have to close your a tag after the span element.

And to keep the good style of it, here's the working code.

i {
      border-radius: 50%;
    border: 2px solid green;
    width: 30px;
    height: 30px;
    display: inline-block;
    text-align: center;
    line-height: 25px !important;
    color: green;
a { text-decoration: none !important; display: inline-block }
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download