CSS中的no-drop和not-allowed有什么区别?

Mal*_*Rao 6 html css stylesheet

我很惊讶地看到"无丢弃"和"不允许"的光标样式在CSS中本质上是相同的.那么,为什么我们都需要它们呢?

Pat*_*rts 5

尽管它们可能对大多数系统产生相同的效果,但它们在语义上有所不同,从而使浏览器和/或系统可以针对每种情况实现不同的图形。no-drop表示该元素未实现拖放API,而这not-allowed是一个通用术语,表示未对该元素启用某些操作。

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;
}
Run Code Online (Sandbox Code Playgroud)
<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>
Run Code Online (Sandbox Code Playgroud)