如何使用相对位置的光标探针,为什么它不起作用?

How to use the cursor proberty with position relative and why does it not work?

大家好,我已经在网上搜索了很长时间了,但我仍然无法修复它。

.login input[type="submit"] {
  background: #2196f3;
  border-radius: 5px;
  border: 1px solid #0d47a1;
  color: #FFF;
  cursor: pointer;
  font-weight: bold;
  line-height: 48px;
  margin-top: 20px;
  position: relative;
  text-align: center;
  text-transform: uppercase;
  width: 242px;
  z-index: -1;
}

我认为这是因为你给了input[type="submit"]一个z-index: -1;

也许 z-index: 0; 适合你。

默认情况下,否定 z-index 会将按钮放在页面其余部分的后面,因此按钮不可用。

试试这个:

.login input[type="submit"] {
  background: #2196f3;
  border-radius: 5px;
  border: 1px solid #0d47a1;
  color: #FFF;
  cursor: pointer;
  font-weight: bold;
  line-height: 48px;
  margin-top: 20px;
  position: relative;
  text-align: center;
  text-transform: uppercase;
  width: 242px;
}
<div class="login">
  <input type="submit" />
</div>

如果您需要 z-index 是因为您希望它位于页面上的其他内容之后,请尝试增加这些元素的 z-index。如果你需要它是一个禁用按钮,尝试在按钮的HTML中添加disabled="disabled"