PHPLover PHPLover - 5 months ago 17
CSS Question

How to remove hover effect from CSS?

I'm currently having a text as hyperlink and on this some CSS code is getting applied. Due to which on hover the text got underline and font gets bold on hover event. But now what I want to do is remove the hyperlink and apply the same effect bydefault i.e. not on hover. In short I want to apply the style currently applying on hover without hovering the text. My HTML and css code is as follows:

.faq .section p.quetn a:hover {
text-decoration:underline;
font-weight:bold
}
<p class="quetn"><a href="">5.14 Where do i see my test results?</a></p>


One more important thig is I can't change the above written CSS, I want to override the above CSS code by writing a new class. Can you help me in achieving this? Thanks in advance.

Answer

Just use the same rule for when the link is not being hovered:

.faq .section p.quetn a, .faq .section p.quetn a:hover {
    text-decoration:underline;
    font-weight:bold
}

EDIT

Juse seen that you can't change the CSS for some reason.

Just create a new class with the same styles.

a.class, a.class:hover {
    text-decoration:underline;
    font-weight:bold
}

<a class="class" title="" href="#">Some Link</a>

EDIT v2

Do you want to style the text but remove the link markup?

It would just be

<p class="class">Text</p>

p.class {
    text-decoration:underline;
    font-weight:bold
}
Comments