前面的话
在浏览器中,光标对于提供交互反馈很有用。通过在不同的场景中改变光标,就能赋予其不同的含义。
定义
cursor光标
值: [
初始值: auto
应用于: 所有元素
继承性: 有
标准样式
CSS2提供了相对较少的选择
<span style="color: #000000;">url: 自定义光标的URL </span><span style="color: #0000ff;">default</span><span style="color: #000000;">: 默认光标,通常是一个箭头 auto: 浏览器自动识别的光标 crosshair : 十字线 pointer: 手型指针 move: 移动指针 e</span>-<span style="color: #000000;">resize: 向东移动指针 ne</span>-<span style="color: #000000;">resize: 向东北移动指针 nw</span>-<span style="color: #000000;">resize: 向西北移动指针 n</span>-<span style="color: #000000;">resize: 向北移动指针 se</span>-<span style="color: #000000;">resize: 向东南移动指针 sw</span>-<span style="color: #000000;">resize: 向西南移动指针 s</span>-<span style="color: #000000;">resize: 向南移动指针 w</span>-<span style="color: #000000;">resize: 向西移动指针 text: 文本指针 wait: 指示程序正忙 help: 帮助指针</span>
拓展样式
CSS3增加了更多的cursor的样式值
[注意]所有拓展样式IE7-浏览器都不支持
<span style="color: #000000;">cursor:none (not IE8, Safari) cursor:context</span>-<span style="color: #000000;">menu (not Safari,Firefox,Chrome) cursor:cell (not Safari) cursor:alias (not Safari) cursor:copy (not IE,Safari) cursor:grab (not IE,Safari,Chrome) cursor:grabbing (not IE,Safari,Chrome) cursor:zoom</span>-<span style="color: #0000ff;">in</span><span style="color: #000000;"> (not IE,Safari) cursor:zoom</span>-<span style="color: #0000ff;">out</span><span style="color: #000000;"> (not IE,Safari) cursor:vertical</span>-<span style="color: #000000;">text cursor:no</span>-<span style="color: #000000;">drop cursor:not</span>-<span style="color: #000000;">allowed cursor:all</span>-<span style="color: #000000;">scroll cursor:ew</span>-<span style="color: #000000;">resize cursor:ns</span>-<span style="color: #000000;">resize cursor:nesw</span>-<span style="color: #000000;">resize cursor:nwse</span>-<span style="color: #000000;">resize cursor:col</span>-<span style="color: #000000;">resize cursor:row</span>-resize
私有样式
有些浏览器还提供了增加浏览器前缀的私有样式
[注意]safari将-webkit-grab和-webkit-grabbing都解释为default
cursor:-webkit-grab; cursor: -moz-<span style="color: #000000;">grab; cursor:</span>-webkit-grabbing; cursor: -moz-<span style="color: #000000;">grabbing; cursor:</span>-webkit-zoom-<span style="color: #0000ff;">in</span>; cursor: -moz-zoom-<span style="color: #0000ff;">in</span><span style="color: #000000;">; cursor:</span>-webkit-zoom-<span style="color: #0000ff;">out</span>; cursor: -moz-zoom-<span style="color: #0000ff;">out</span>;
自定义样式
所有浏览器都支持使用后缀名为.cur的文件,chrome、firefox、safari还支持使用普通图片制作光标
[注意]使用URL自定义样式,后面必须跟有一个逗号和某个通用关键字
<span style="color: #008000;">//</span><span style="color: #008000;">错误</span> cursor: url(<span style="color: #800000;">'</span><span style="color: #800000;">m.cur</span><span style="color: #800000;">'</span><span style="color: #000000;">); </span><span style="color: #008000;">//</span><span style="color: #008000;">正确</span> cursor: url(<span style="color: #800000;">'</span><span style="color: #800000;">m.cur</span><span style="color: #800000;">'</span>),auto;
常见应用
链接的默认光标是手型指针pointer,通过光标的变化可以让访问者清楚的知道该元素是可点击的
元素的title属性用来提供元素的额外信息,配合help光标可以得到更好的表现方式
<span style="color: #800000;">span[title]</span>{<span style="color: #ff0000;"> cursor</span>:<span style="color: #0000ff;"> help</span>;<span style="color: #ff0000;"> border-bottom</span>:<span style="color: #0000ff;"> 1px solid gray</span>; }
<span style="color: #0000ff;"><span style="color: #800000;">div</span><span style="color: #0000ff;">><span style="color: #800000;">span </span><span style="color: #ff0000;">title</span><span style="color: #0000ff;">="Cascading Style Sheets"</span><span style="color: #0000ff;">></span>CSS<span style="color: #0000ff;"></span><span style="color: #800000;">span</span><span style="color: #0000ff;">></span> is much too interesting<span style="color: #0000ff;"></span><span style="color: #800000;">div</span><span style="color: #0000ff;">></span></span></span>

HTMLattributesarecrucialinwebdevelopmentforcontrollingbehavior,appearance,andfunctionality.Theyenhanceinteractivity,accessibility,andSEO.Forexample,thesrcattributeintagsimpactsSEO,whileonclickintagsaddsinteractivity.Touseattributeseffectively:1)Usese

The alt attribute is an important part of the tag in HTML and is used to provide alternative text for images. 1. When the image cannot be loaded, the text in the alt attribute will be displayed to improve the user experience. 2. Screen readers use the alt attribute to help visually impaired users understand the content of the picture. 3. Search engines index text in the alt attribute to improve the SEO ranking of web pages.

The roles of HTML, CSS and JavaScript in web development are: 1. HTML is used to build web page structure; 2. CSS is used to beautify the appearance of web pages; 3. JavaScript is used to achieve dynamic interaction. Through tags, styles and scripts, these three together build the core functions of modern web pages.

Setting the lang attributes of a tag is a key step in optimizing web accessibility and SEO. 1) Set the lang attribute in the tag, such as. 2) In multilingual content, set lang attributes for different language parts, such as. 3) Use language codes that comply with ISO639-1 standards, such as "en", "fr", "zh", etc. Correctly setting the lang attribute can improve the accessibility of web pages and search engine rankings.

HTMLattributesareessentialforenhancingwebelements'functionalityandappearance.Theyaddinformationtodefinebehavior,appearance,andinteraction,makingwebsitesinteractive,responsive,andvisuallyappealing.Attributeslikesrc,href,class,type,anddisabledtransform

TocreatealistinHTML,useforunorderedlistsandfororderedlists:1)Forunorderedlists,wrapitemsinanduseforeachitem,renderingasabulletedlist.2)Fororderedlists,useandfornumberedlists,customizablewiththetypeattributefordifferentnumberingstyles.

HTML is used to build websites with clear structure. 1) Use tags such as, and define the website structure. 2) Examples show the structure of blogs and e-commerce websites. 3) Avoid common mistakes such as incorrect label nesting. 4) Optimize performance by reducing HTTP requests and using semantic tags.

ToinsertanimageintoanHTMLpage,usethetagwithsrcandaltattributes.1)UsealttextforaccessibilityandSEO.2)Implementsrcsetforresponsiveimages.3)Applylazyloadingwithloading="lazy"tooptimizeperformance.4)OptimizeimagesusingtoolslikeImageOptimtoreduc


Hot AI Tools

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Undress AI Tool
Undress images for free

Clothoff.io
AI clothes remover

Video Face Swap
Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Article

Hot Tools

EditPlus Chinese cracked version
Small size, syntax highlighting, does not support code prompt function

SublimeText3 English version
Recommended: Win version, supports code prompts!

PhpStorm Mac version
The latest (2018.2.1) professional PHP integrated development tool

Dreamweaver Mac version
Visual web development tools

Safe Exam Browser
Safe Exam Browser is a secure browser environment for taking online exams securely. This software turns any computer into a secure workstation. It controls access to any utility and prevents students from using unauthorized resources.
