Home  >  Article  >  Web Front-end  >  How to set css mouse pointer to image style

How to set css mouse pointer to image style

青灯夜游
青灯夜游Original
2021-11-09 16:20:344400browse

In CSS, you can use the cursor attribute to set the mouse pointer to an image style. You only need to add one or more comma-separated "url()" values ​​to the cursor attribute to specify the image used as the mouse pointer. Yes, the syntax is "cursor:url(picture file path)".

How to set css mouse pointer to image style

The operating environment of this tutorial: Windows 7 system, CSS3&&HTML5 version, Dell G3 computer.

In CSS, you can use the cursor attribute to customize the mouse pointer and set the mouse pointer to an image style.

Syntax:cursor:url(picture file path);

One or more comma-separated url() used to point to the image to be used as the cursor. The user agent retrieves the cursor url() from the first one. If the user agent cannot handle the first cursor of the cursor list, it must try to handle the cursor list and so on.

Example:

<!DOCTYPE html>
<html>
	<head>
		<style>
			div{
				height: 100px;
				background-color: #FFC0CB;
				cursor: url(https://img.php.cn/upload/article/000/000/024/618a2ac4b581f274.png), pointer;
			}
		</style>
	</head>
	<body>
		<div></div>
	</body>
</html>

Rendering:

How to set css mouse pointer to image style

Note: Required if the user agent cannot handle any of the provided images Use the cursor keyword.

(Learning video sharing: css video tutorial)

The above is the detailed content of How to set css mouse pointer to image style. 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