What is the default value of the "cursor" attribute?

Asked

Viewed 190 times

3

What is the default value of the "cursor attribute"?

I changed the value to pointer, but in a certain case I prefer to return to the default arrow, but I don’t know what is the value.

4 answers

6

The default value is default:

.exemplo {
   cursor:default;
}

The following is an example of possible values for the attribute cursor, just pass the mouse cursor over each one to view how they work:

<span style="cursor:auto">auto</span><br>
<span style="cursor:crosshair">crosshair</span><br>
<span style="cursor:default">default</span><br>
<span style="cursor:e-resize">e-resize</span><br>
<span style="cursor:grab">grab</span><br>
<span style="cursor:help">help</span><br>
<span style="cursor:move">move</span><br>
<span style="cursor:n-resize">n-resize</span><br>
<span style="cursor:ne-resize">ne-resize</span><br>
<span style="cursor:nw-resize">nw-resize</span><br>
<span style="cursor:pointer">pointer</span><br>
<span style="cursor:progress">progress</span><br>
<span style="cursor:s-resize">s-resize</span><br>
<span style="cursor:se-resize">se-resize</span><br>
<span style="cursor:sw-resize">sw-resize</span><br>
<span style="cursor:text">text</span><br>
<span style="cursor:w-resize">w-resize</span><br>
<span style="cursor:wait">wait</span><br>
<span style="cursor:not-allowed">not-allowed</span><br>
<span style="cursor:no-drop">no-drop</span><br>

  • 1

    Thank you. I had tried normal and it didn’t work.

3

The CSS cursor property specifies the mouse cursor shown when the mouse pointer is on an element.

The initial value of this property is auto, what happens is that he is converted by browser in another property according to its context, usually in default (The little arrow we’re used to seeing).

cursor: auto; Brower determines the cursor to be displayed based on in the current context.

Links to reference:

Cursor - MDN

Cursor - W3schools

  • It has an interesting detail: If the value is auto in a <a>, would be the same as using pointer. This clarifies perfectly what is the default value of cursor, but for the arrow the value is default.

  • 1

    Yes, it identifies the cursor due to its context, if you want to force the arrow you must set the property default as cited by leandro.

3


Not, the initial value is not cursor: default as the first response states, but yes cursor: auto, already default is a "cursor type" in this case:

cursor:default

The answers that quote the cursor: auto yes are correct.

The cursor: auto makes the browser (based on an internal style probably) apply a type of cursor based on the type of the element and to restore to the "default" value I believe the best way is to use the value initial (despite auto function), however to others estates initial is what will work.

The value initial

The keyword initial applies the initial value for an element property, this can be used for any property

An example of MDN:

p {
  color: red;
}

em, a {
  color: initial;
}
<p>
  <span>Ficará em vermelho.</span>
  <em>Voltará a cor padrão inicial do navegador</em>
  <a href="#">Voltará a cor padrão inicial do navegador</a>
  <span>Em vermelho</span>
</p>

Using with the property cursor:

.area-com-cursor-customizado {
    cursor: pointer;
}
.area-com-valor-inicial {
    cursor: initial;
}
<div class="area-com-cursor-customizado">
   <p>foo bar baz</p>
   <p>foo bar baz</p>
   <p>foo bar baz</p>
   
   <div class="area-com-valor-inicial">
       <p>foo bar baz</p>
       <p>foo bar baz</p>
       <p>foo bar baz</p>
       <p>foo bar baz</p>
   </div>
   
   <p>foo bar baz</p>
   <p>foo bar baz</p>
   <p>foo bar baz</p>
   <p>foo bar baz</p>
</div>

2

Hello, the cursor pattern will depend on the context. To use the common arrow you could use cursor: default, but if you want the pattern in context, use cursor: auto.

Browser other questions tagged

You are not signed in. Login or sign up in order to post.