HTML 屬性中的遊標透過使用特定類型的遊標屬性來控制遊標懸停在任何 HTML 元素上時的形狀或外觀和感覺。這個概念僅適用於任何有遊標和滑鼠的設備;如果沒有,此功能可能會產生與遊標屬性相關的任何結果。此遊標屬性的目的是使用圖像在任何表單上提交按鈕。每當最終用戶將滑鼠懸停在圖像上時,如果這是一個提交按鈕,它會透過點擊它自動向您提供該圖像正在用作按鈕的線索。
遊標屬性在 HTML 中如何運作?
HTML 遊標屬性是基於 HTML 標籤內的樣式屬性工作。我們將研究 HTML 中的一些不同的遊標語法。
文法 #1
<span style="cursor:auto">auto</span>
文法#2
<span style="cursor:crosshair">crosshair</span>
文法#3
<span style="cursor:default">default</span>
文法#4
<span style="cursor:e-resize">e-resize</span>
文法#5
<span style="cursor:help">help</span>
文法 #6
<span style="cursor:move">move</span>
文法#7
<span style="cursor:n-resize">n-resize</span>
文法#8
<span style="cursor:ne-resize">ne-resize</span>
文法 #9
<span style="cursor:nw-resize">nw-resize</span>
文法#10
<span style="cursor:pointer">pointer</span>
文法#11
<span style="cursor:progress">progress</span>
文法#12
<span style="cursor:s-resize">s-resize</span>
文法#13
<span style="cursor:se-resize">se-resize</span>
文法#14
<span style="cursor:sw-resize">sw-resize</span>
文法#15
<span style="cursor:text">text</span>
文法#16
<span style="cursor:w-resize">w-resize</span>
文法#17
<span style="cursor:wait">wait</span>
Cursor Values and its Description Table
Type | HTML Value | How Cursor Look Like? | Description | |||||
General | auto | Based on the text cursor will change automatically. | ||||||
default | ![]() |
By default, an arrow cursor. | ||||||
none | No cursor is displayed. | |||||||
Links & Status | context-menu | ![]() |
Cursor like context menu | |||||
help | ![]() |
Help information with an arrow question mark. | ||||||
pointer | ![]() |
Pointer symbol with a hand like a cursor. | ||||||
progress | ![]() |
Says program is busy and can able to interact with the application. | ||||||
wait | ![]() |
Says program is busy and cannot able to interact with the application. | ||||||
Selection | cell | ![]() |
Cells can be selected from the table showing the cursor. | |||||
crosshair | ![]() |
Cross cursor used for selection. | ||||||
text | ![]() |
An I-beam cursor used for the selected text. | ||||||
vertical-text | ![]() |
A sideway I-beam cursor used for the vertical selected text. | ||||||
Drag & Drop | alias | ![]() |
shortcut cursor | |||||
copy | ![]() |
Copied cursor | ||||||
move | ![]() |
the element can be moved with the cursor. | ||||||
no-drop |
|
項目未掉落,顯示遊標。 | ||||||
不允許 | ![]() |
請求無法繼續遊標操作。 | ||||||
抓住 | ![]() |
抓住遊標 | ||||||
抓 | ![]() |
有東西被抓住遊標。 | ||||||
調整大小和滾動 | 全滾動 |
|
![]() |
|||||
在顯示遊標的任何特定方向上捲動。 |
![]() |
|||||||
項目/列可以水平調整大小。 ![]() |
||||||||
項目/列可以垂直調整大小。 ![]() |
||||||||
在顯示遊標的特定顯示方向上移動的任何邊緣。 ![]() |
||||||||
電子調整大小 |
![]() |
|||||||
s-調整大小 |
![]() |
|||||||
w-調整大小 |
![]() |
|||||||
重新調整大小 |
![]() |
|||||||
西北調整大小 |
![]() |
|||||||
自動調整大小 |
![]() |
|||||||
sw-調整大小 |
![]() |
調整大小 | ||||||
雙向調整遊標大小。 ![]() |
||||||||
ns-調整大小 |
![]() |
|||||||
新調整大小 |
![]() |
|||||||
nwse-調整大小 |
![]() |
放大 | ||||||
放大縮小顯示遊標![]() |
Examples to Implement Cursor in HTML
Below are the examples mentioned:
Example #1
Links and Status showing cursors.
Code:
<meta charset="ISO-8859-1"> <title>Cursors in HTML</title> <style type="text/css"> .div2 { border: 1px solid brown; color: green; width: 900px; font-size: 20px; } .div3 { border: 1px solid brown; color: red; width: 900px; font-size: 20px; } .div4 { border: 1px solid brown; color: blue; width: 900px; font-size: 20px; } .div5 { border: 1px solid brown; color: lime; width: 900px; font-size: 20px; } </style> <div class="div2"> <h3 id="Progress-Cursor-Demo">Progress Cursor Demo</h3> <span style="cursor: progress">Cursor in HTML property controls shape or look and feel of the cursor when it is hovering on the any HTML element by using specific type of cursor property.</span> </div> <br> <div class="div3"> <h3 id="Help-Cursor-Demo">Help Cursor Demo</h3> <span style="cursor: help">Cursor in HTML property controls shape or look and feel of the cursor when it is hovering on the any HTML element by using specific type of cursor property.</span> </div> <br> <div class="div4"> <h3 id="Pointer-Cursor-Demo">Pointer Cursor Demo</h3> <span style="cursor: pointer">Cursor in HTML property controls shape or look and feel of the cursor when it is hovering on the any HTML element by using specific type of cursor property.</span> </div> <br> <div class="div5"> <h3 id="Wait-Cursor-Demo">Wait Cursor Demo</h3> <span style="cursor: wait">Cursor in HTML property controls shape or look and feel of the cursor when it is hovering on the any HTML element by using specific type of cursor property.</span> </div>
Output:
Explanation: In the above output, click any paragraph for seeing the corresponding cursor output.
Example #2
Selection showing cursors
Code:
<meta charset="ISO-8859-1"> <title>Cursors in HTML</title> <style type="text/css"> .div2 { border: 1px solid blue; color: fuchsia; width: 900px; font-size: 20px; } .div3 { border: 1px solid blue; color: gray; width: 900px; font-size: 20px; } .div4 { border: 1px solid blue; color: maroon; width: 900px; font-size: 20px; } </style> <div class="div2"> <h3 id="Cross-hair-Cursor-Demo">Cross hair Cursor Demo</h3> <span style="cursor: crosshair">Cursor in HTML property controls shape or look and feel of the cursor when it is hovering on the any HTML element by using specific type of cursor property.</span> </div> <br> <div class="div3"> <h3 id="Horizontal-Text-Cursor-Demo">Horizontal Text Cursor Demo</h3> <span style="cursor: text">Cursor in HTML property controls shape or look and feel of the cursor when it is hovering on the any HTML element by using specific type of cursor property.</span> </div> <br> <div class="div4"> <h3 id="Vertical-Text-Cursor-Demo">Vertical Text Cursor Demo</h3> <span style="cursor: vertical-text">Cursor in HTML property controls shape or look and feel of the cursor when it is hovering on the any HTML element by using specific type of cursor property.</span> </div>
Output:
Explanation: In the above output, click any paragraph for seeing the corresponding cursor output.
Example #3
Drag and drop showing cursors.
Code:
<meta charset="ISO-8859-1"> <title>Cursors in HTML</title> <style type="text/css"> .div2 { border: 1px solid red; color: orange; width: 900px; font-size: 20px; } .div3 { border: 1px solid red; color: olive; width: 900px; font-size: 20px; } .div4 { border: 1px solid red; color: navy; width: 900px; font-size: 20px; } .div5 { border: 1px solid red; color: lime; width: 900px; font-size: 20px; } .div6 { border: 1px solid red; color: blue; width: 900px; font-size: 20px; } .div7 { border: 1px solid red; color: maroon; width: 900px; font-size: 20px; } </style> <div class="div2"> <h3 id="Alias-Cursor-Demo">Alias Cursor Demo</h3> <span style="cursor: alias">Cursor in HTML property controls shape or look and feel of the cursor when it is hovering on the any HTML element by using specific type of cursor property.</span> </div> <br> <div class="div3"> <h3 id="Copy-Cursor-Demo">Copy Cursor Demo</h3> <span style="cursor: copy">Cursor in HTML property controls shape or look and feel of the cursor when it is hovering on the any HTML element by using specific type of cursor property.</span> </div> <br> <div class="div4"> <h3 id="Move-Cursor-Demo">Move Cursor Demo</h3> <span style="cursor: move">Cursor in HTML property controls shape or look and feel of the cursor when it is hovering on the any HTML element by using specific type of cursor property.</span> </div> <br> <div class="div5"> <h3 id="No-drop-Cursor-Demo">No-drop Cursor Demo</h3> <span style="cursor: no-drop">Cursor in HTML property controls shape or look and feel of the cursor when it is hovering on the any HTML element by using specific type of cursor property.</span> </div> <br> <div class="div6"> <h3 id="Grab-Cursor-Demo">Grab Cursor Demo</h3> <span style="cursor: grab">Cursor in HTML property controls shape or look and feel of the cursor when it is hovering on the any HTML element by using specific type of cursor property.</span> </div> <br> <div class="div7"> <h3 id="Not-allowed-Cursor-Demo">Not-allowed Cursor Demo</h3> <span style="cursor: not-allowed">Cursor in HTML property controls shape or look and feel of the cursor when it is hovering on the any HTML element by using specific type of cursor property.</span> </div>
Output:
Explanation: In the above output, click any paragraph for seeing the corresponding cursor output.
Example #4
Selection showing cursors.
Code:
<meta charset="ISO-8859-1"> <title>Cursors in HTML</title> <style type="text/css"> .div2 { border: 1px solid fuchsia; color: teal; width: 900px; font-size: 20px; } .div3 { border: 1px solid fuchsia; color: purple; width: 900px; font-size: 20px; } </style> <div class="div2"> <h3 id="Zoom-in-Cursor-Demo">Zoom-in Cursor Demo</h3> <span style="cursor: zoom-in">Cursor in HTML property controls shape or look and feel of the cursor when it is hovering on the any HTML element by using specific type of cursor property.</span> </div> <br> <div class="div3"> <h3 id="Zoom-out-Cursor-Demo">Zoom-out Cursor Demo</h3> <span style="cursor: zoom-out">Cursor in HTML property controls shape or look and feel of the cursor when it is hovering on the any HTML element by using specific type of cursor property.</span> </div>
Output:
Explanation: In the above output, click any paragraph for seeing the corresponding cursor output.
Conclusion
Cursor property works based on property value given to the cursor. Based on the requirement, we choose which cursor action required at the instant.
以上是HTML 中的遊標的詳細內容。更多資訊請關注PHP中文網其他相關文章!

本篇文章带大家了解一下HTML(超文本标记语言),介绍一下HTML的本质,HTML文档的结构、HTML文档的基本标签和图像标签、列表、表格标签、媒体元素、表单,希望对大家有所帮助!

不算。html是一种用来告知浏览器如何组织页面的标记语言,而CSS是一种用来表现HTML或XML等文件样式的样式设计语言;html和css不具备很强的逻辑性和流程控制功能,缺乏灵活性,且html和css不能按照人类的设计对一件工作进行重复的循环,直至得到让人类满意的答案。

总结了一些web前端面试(笔试)题分享给大家,本篇文章就先给大家分享HTML部分的笔试题(附答案),大家可以自己做做,看看能答对几个!

HTML5中画布标签是“<canvas>”。canvas标签用于图形的绘制,它只是一个矩形的图形容器,绘制图形必须通过脚本(通常是JavaScript)来完成;开发者可利用多种js方法来在canvas中绘制路径、盒、圆、字符以及添加图像等。

在html中,document是文档对象的意思,代表浏览器窗口的文档;document对象是window对象的子对象,所以可通过“window.document”属性对其进行访问,每个载入浏览器的HTML文档都会成为Document对象。

html5废弃了dir列表标签。dir标签被用来定义目录列表,一般和li标签配合使用,在dir标签对中通过li标签来设置列表项,语法“<dir><li>列表项值</li>...</dir>”。HTML5已经不支持dir,可使用ul标签取代。

3种取消方法:1、给td元素添加“border:none”无边框样式即可,语法“td{border:none}”。2、给td元素添加“border:0”样式,语法“td{border:0;}”,将td边框的宽度设置为0即可。3、给td元素添加“border:transparent”样式,语法“td{border:transparent;}”,将td边框的颜色设置为透明即可。


熱AI工具

Undresser.AI Undress
人工智慧驅動的應用程序,用於創建逼真的裸體照片

AI Clothes Remover
用於從照片中去除衣服的線上人工智慧工具。

Undress AI Tool
免費脫衣圖片

Clothoff.io
AI脫衣器

AI Hentai Generator
免費產生 AI 無盡。

熱門文章

熱工具

SAP NetWeaver Server Adapter for Eclipse
將Eclipse與SAP NetWeaver應用伺服器整合。

mPDF
mPDF是一個PHP庫,可以從UTF-8編碼的HTML產生PDF檔案。原作者Ian Back編寫mPDF以從他的網站上「即時」輸出PDF文件,並處理不同的語言。與原始腳本如HTML2FPDF相比,它的速度較慢,並且在使用Unicode字體時產生的檔案較大,但支援CSS樣式等,並進行了大量增強。支援幾乎所有語言,包括RTL(阿拉伯語和希伯來語)和CJK(中日韓)。支援嵌套的區塊級元素(如P、DIV),

記事本++7.3.1
好用且免費的程式碼編輯器

SublimeText3 Mac版
神級程式碼編輯軟體(SublimeText3)

Safe Exam Browser
Safe Exam Browser是一個安全的瀏覽器環境,安全地進行線上考試。該軟體將任何電腦變成一個安全的工作站。它控制對任何實用工具的訪問,並防止學生使用未經授權的資源。