Curseur dans la propriété HTML contrôle la forme ou l'apparence du curseur lorsqu'il survole un élément HTML en utilisant un type spécifique de propriété de curseur. Ce concept s'applique uniquement aux appareils dotés d'un curseur et d'une souris ; sinon, cette fonctionnalité pourrait obtenir des résultats pertinents avec la propriété du curseur. Le but de cette propriété de curseur est d'utiliser des images pour soumettre des boutons sur n'importe quel formulaire. Chaque fois qu'un utilisateur final survole une image, s'il s'agit d'un bouton de soumission, il vous indique automatiquement que l'image fonctionne comme un bouton en cliquant dessus.
La propriété du curseur HTML fonctionne sur la base de la propriété de style dans la balise HTML. Nous étudierons différentes syntaxes de curseur en HTML.
Syntaxe n°1
<span style="cursor:auto">auto</span>
Syntaxe #2
<span style="cursor:crosshair">crosshair</span>
Syntaxe #3
<span style="cursor:default">default</span>
Syntaxe #4
<span style="cursor:e-resize">e-resize</span>
Syntaxe #5
<span style="cursor:help">help</span>
Syntaxe #6
<span style="cursor:move">move</span>
Syntaxe #7
<span style="cursor:n-resize">n-resize</span>
Syntaxe #8
<span style="cursor:ne-resize">ne-resize</span>
Syntaxe #9
<span style="cursor:nw-resize">nw-resize</span>
Syntaxe #10
<span style="cursor:pointer">pointer</span>
Syntaxe #11
<span style="cursor:progress">progress</span>
Syntaxe #12
<span style="cursor:s-resize">s-resize</span>
Syntaxe #13
<span style="cursor:se-resize">se-resize</span>
Syntaxe #14
<span style="cursor:sw-resize">sw-resize</span>
Syntaxe #15
<span style="cursor:text">text</span>
Syntaxe #16
<span style="cursor:w-resize">w-resize</span>
Syntaxe #17
<span style="cursor:wait">wait</span>
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 |
|
Element wurde nicht abgelegt, Cursor wird angezeigt. | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
nicht erlaubt | Anfrage kann Cursoraktion nicht übertragen. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
zupacken | Cursor erfasst | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
zupackend | Etwas wird mit dem Cursor erfasst. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Größe ändern und scrollen | Alles scrollen |
|
|
|
|
In eine bestimmte Richtung gescrollt, wobei der Cursor angezeigt wird.
|
|
|
|
|
Die Größe des Elements/der Spalte kann horizontal geändert werden.
|
|
|
|
Die Größe des Elements/der Spalte kann vertikal geändert werden.
|
|
|
|
Jede Kante bewegt sich in eine bestimmte angezeigte Richtung und zeigt den Cursor an.
|
|
e-Größe ändern
|
|
|
S-Größe ändern
|
|
|
W-Größe ändern
|
|
|
ne-resize
|
|
|
nw-resize
|
|
|
Größe ändern
|
|
|
sw-resize
|
|
|
neue Größenänderung |
| Bidirektionaler Größenänderungscursor.
|
|
ns-resize
|
|
|
new-resize
|
|
|
nwse-resize
|
|
Zoomen |
|
Vergrößern |
| Vergrößern und Verkleinern zeigt den Cursor an
|
|
|
Below are the examples mentioned:
Links and Status showing cursors.
Code:
<!DOCTYPE html> <html> <head> <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> </head> <body> <div class="div2"> <h3 style="text-align: center">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 style="text-align: center">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 style="text-align: center">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 style="text-align: center">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> </html>
Output:
Explanation: In the above output, click any paragraph for seeing the corresponding cursor output.
Selection showing cursors
Code:
<!DOCTYPE html> <html> <head> <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> </head> <body> <div class="div2"> <h3 style="text-align: center">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 style="text-align: center">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 style="text-align: center">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> </html>
Output:
Explanation: In the above output, click any paragraph for seeing the corresponding cursor output.
Drag and drop showing cursors.
Code:
<!DOCTYPE html> <html> <head> <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> </head> <body> <div class="div2"> <h3 style="text-align: center">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 style="text-align: center">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 style="text-align: center">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 style="text-align: center">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 style="text-align: center">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 style="text-align: center">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> </html>
Output:
Explanation: In the above output, click any paragraph for seeing the corresponding cursor output.
Selection showing cursors.
Code:
<!DOCTYPE html> <html> <head> <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> </head> <body> <div class="div2"> <h3 style="text-align: center">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 style="text-align: center">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> </html>
Output:
Explanation: In the above output, click any paragraph for seeing the corresponding cursor output.
Cursor property works based on property value given to the cursor. Based on the requirement, we choose which cursor action required at the instant.
Ce qui précède est le contenu détaillé de. pour plus d'informations, suivez d'autres articles connexes sur le site Web de PHP en chinois!