禁用div加更改光标

时间:2019-02-09 00:58:37

标签: html css

我有div元素需要禁用。因此,我为其定义了以下 CSS 类:

.hideDiv {
    pointer-events: none;
    cursor: not-allowed;
}

虽然CSS类的第一行工作正常,但第二行却行不通。你能帮我吗?

请注意,我需要在Internet Explorer上进行此项工作。

1 个答案:

答案 0 :(得分:1)

image: java:8 stages: - build - deploy build: stage: build script: ./mvnw package artifacts: paths: - target/demo-0.0.1-SNAPSHOT.jar production: stage: deploy script: - curl --location "https://cli.run.pivotal.io/stable?release=linux64-binary&source=github" | tar zx - ./cf login -u $CF_USERNAME -p $CF_PASSWORD -a api.run.pivotal.io - ./cf push only: - /^cis-rel.*$/ 将有效地停止鼠标与pointer-events: none的交互。这意味着还可以防止将鼠标悬停在div上,从而不会显示光标。

相反,您可以将.hideDiv包裹在另一个div中,然后将cursor属性添加到外部/父div中。

请参见以下示例:

.hideDiv
.box {
  height: 100px;
  width: 100px;
  border: 1px solid black;
}

.parent {
  cursor: not-allowed;
}

.hideDiv {
  pointer-events: none;
}

/* Remove pointer-events: none and the below css works */
.hideDiv:hover {
  background-color: lime;
}