Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What is the difference between no-drop and not-allowed in CSS?

I was surprised to see that the cursor styles for "no-drop" and "not-allowed" are same in nature in CSS. So, why do we need them both?

like image 980
Mallikarjuna Rao Avatar asked Apr 28 '15 06:04

Mallikarjuna Rao


1 Answers

While they may cause the same effect on most systems, they are semantically different, allowing the browser and / or system to implement a different graphic for each case. no-drop implies that the element does not implement the drag-and-drop API, while not-allowed is a generic term meaning that some action is not enabled on the element.

div {
  padding: 5px;
  margin: 5px;
}

pre {
  display: inline-block;
  background-color: #DDDDDD;
}

.no-drop {
  background-color: #DD22DD;
  cursor: no-drop;
}

.not-allowed {
  background-color: #DDDD22;
  cursor: not-allowed;
}
<div class="no-drop">This area displays the <pre>no-drop</pre> cursor.</div>

<div class="not-allowed">This area displays the <pre>not-allowed</pre> cursor.</div>
like image 136
Patrick Roberts Avatar answered Nov 15 '22 21:11

Patrick Roberts