Home  >  Article  >  Web Front-end  >  How to set hyperlinks to be non-clickable in css

How to set hyperlinks to be non-clickable in css

藏色散人
藏色散人Original
2021-04-29 11:27:012566browse

How to set the hyperlink to be non-clickable in css: first use the "cursor:pointer;" attribute to turn the mouse into an arrow; then use the "pointer-events:none;" attribute to make the hyperlink invalid and non-clickable.

How to set hyperlinks to be non-clickable in css

The operating environment of this article: windows7 system, HTML5&&CSS3 version, DELL G3 computer.

Use css settings to make hyperlinks unclickable or invalid

##cursor :pointer;

pointer-events: none;
The first line is to make the mouse turn into an arrow instead of a small hand shape
The second line is to invalidate the hyperlink code

Not only a tag and iframe tag are also valid. The example is as follows:

<!DOCTYPE html><html>
	<head>
		<meta charset="utf-8">
		<title></title>
	</head>
	<body>
		<a class="weather" href="http://www.baidu.com" >测试</a>
		<iframe class="weather" allowtransparency="true" frameborder="0" width="385" height="96" scrolling="no" src="//tianqi.2345.com/plugin/widget/index.htm?s=2&z=2&t=0&v=0&d=3&bd=0&k=&f=&ltf=009944&htf=cc0000&q=1&e=0&a=0&c=60813&w=385&h=96&align=center"></iframe>
	</body>
	<style type="text/css">
	.weather{
	    color:gray;
	    cursor:pointer;
	    pointer-events: none;
	}	</style></html>

How to set hyperlinks to be non-clickable in css

Original display effect: After hovering the mouse, it will be a small hand shape, the style will change, and it will jump after clicking To the hyperlink

How to set hyperlinks to be non-clickable in css

The display effect after the change: the mouse is in the shape of an arrow when hovering, and there is no response when clicking

For more detailed HTML/CSS knowledge, please visit

CSS video tutorial column!

The above is the detailed content of How to set hyperlinks to be non-clickable in css. For more information, please follow other related articles on the PHP Chinese website!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Previous article:How to set html hyperlinkNext article:How to set html hyperlink