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.html.cn/">
- HTML 中文网
- </a>
- </body>
- </HTML>
效果图:
来源: http://www.css88.com/qa/css3/12799.html