主要设施中提供的<a> Should only be underlined when hovering, however when I already clicked the link once (:visited) it stays underlined

时间:2017-10-14 14:34:36

标签: html css

I want the links to be underlined only when I hover my mouse over them. That works perfectly fine when I test in incognito mode, but when I test the link in normal mode it is already underlined when I once clicked the link/visited the page. How can I fix it and make the link only appear underlined when I hover over it?

My CSS file:

a.hover {
    text-decoration: none;
}
a.hover:link, a.hover:visited {
    text-decoration: none;
}

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

And my HTML file:

<p align="center">
  <a href="https://en.wikipedia.org/wiki/Ron_Paul"
     class="hover" target="_blank"><i>Ron Paul</i></a>
</p>

1 个答案:

答案 0 :(得分:0)

试试这个

body a.hover:link, body a.hover:visited, body a.hover:focus, body a.hover:active{ text-decoration:none; }

如果由于某种原因这不起作用,请添加其他选择器以提高特异性。

示例:

text-decoration:none!important;

如果仍然无效,请添加!important

def customersProfile(request, customer_id, sys_type): sys_type=sys_type area="profile" site_credit = site_credit1 time_now=timezone.now() customers=get_object_or_404(CustomerInfo, pk=customer_id) html_string = render_to_string('shop/profile.html', {'customers': customers, 'todaydate': today_date,'site_name': 'Moon Telecom', 'time_now': time_now, 'site_credit': site_credit, 'area': area}) html = HTML(string=html_string) result = html.write_pdf() response = HttpResponse(content_type='application/pdf;') response['Content-Disposition'] = 'inline; filename=list_people.pdf' response['Content-Transfer-Encoding'] = 'binary' with tempfile.NamedTemporaryFile(delete=True) as output: output.write(result) output.flush() output = open(output.name, 'r') response.write(output.read()) return response

相关问题