css如何设置超链接不可点击?

css可以通过pointer-events、color、cursor属性设置超链接颜色、鼠标样式和链接失效实现超链接不可点击效果。

设置超链接不可点击的css样式:

a{ 
pointer-events:none; 
color:#afafaf; 
cursor:default 
}

上述样式详解:

pointer-events:none;设置链接失效,pointer-events属性指定在什么情况下 (如果有) 某个特定的图形元素可以成为鼠标事件的target。

color:#afafaf;样式设置链接颜色为灰色。

cursor:default设置鼠标在链接上的样式。

示例

<!DOCTYPE html> 
<html xmlns="http://www.w3.org/1999/xhtml"> 
<head> 
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> 
<title>设置超链接不可点击实例</title> 
<style> 
a{ 
pointer-events:none; 
color:#afafaf; 
cursor:default 
} 
</style> 
</head> 
<body> 
<a href="https://www.0133.cn/">HTML中文网</a>
</body> 
</html>

效果图:

1.jpg-600

以上就是css如何设置超链接不可点击?的详细内容,更多请关注0133技术站其它相关文章!

赞(0) 打赏
未经允许不得转载:0133技术站首页 » CSS3 答疑