Home > Article > Web Front-end > How to set css mouse pointer to image style
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)".
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:
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!