0

I have a block with div inside:

<div>
   <div class="do">Do it</div>
</div>

Element .do has cursor: none, but parent div has cursor.

How to remove cursor from .do element? Now parent block sets this property

2
  • Can you provide an example of it not working as intended? Commented Mar 30, 2020 at 14:55
  • Tread carefully. Hiding the cursor is bad practice. Commented Mar 30, 2020 at 14:56

3 Answers 3

2

It should come with simple rule

div {
  cursor: pointer;
}
.do {
  cursor: none;
}
<div>
   <div class="do">Do it</div>
</div>

Sign up to request clarification or add additional context in comments.

Comments

2

You're probably dealing with CSS Precedence Rule. Have a look at this Specificity doc for further details.

I am assuming, this is what's happening (Pasted code from Nicolae's answer)

.withCursor > .withoutCursor {
  cursor: pointer;
}
.withCursor {
  cursor: pointer;
}
.withoutCursor {
  cursor: none;
}
<div class="withCursor">
   <div class="withoutCursor">Do it</div>
</div>

As you may notice, the rule for .withoutCursor gets overridden by the .withCursor > .withoutCursor.

If you figure out the right selector for your .do, or remove the one that overrides it, this should be trivial.

Comments

1

.withCursor {
  cursor: pointer;
}

.withoutCursor {
  cursor: none;
}

.withInitialCursor {
  cursor: initial;
}
<div class="withCursor">
   <div class="withoutCursor">None</div>
   <div class="withInitialCursor">Cursor initial</div>
   <div>Cursor pointer - inherited</div>
</div>

You can just do cursor: none to the inner element.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.