I have a list of links which style I control by CSS. I got a problem with the URL they are going, so I want to control that by javascript. So in my <a>
i dont want to have href="link.html'
but if I take that off, the properties that I had with CSS stop working.
a{
text-decoration: none;
color: #808080;
}
a:visited {
text-decoration: none;
color: #808080;
}
a:hover{
text-decoration: none;
color: blue;
}
How can I keed that properties only having a <a>
tag?
You could just return false on your links. Like:
<a href="link.html" onclick="return false;" >Link</a>
添加href="#"
是什么使CSS能够正常工作,并且这种链接不会将用户处理到另一个页面中。
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.