css - :hover works in firebug but not in firefox

标签 css firefox

我创建了一个 div,悬停时我希望背景颜色变为红色。当我在 Firefox 中查看它并将鼠标悬停在 div 上时,没有任何反应。我可以在 Firebug 中检查它并强制悬停类 - 这有效!但为什么它不能在浏览器中正常工作?

<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <meta http-equiv="X-UA-Compatible" content="ie=edge">
  <title>Document</title>
  <link rel="stylesheet" href="main.css">
</head>
<body>
  <button>
    <div class="outer-circle">
     <p>HELLO WORLD!</p>
    </div>
 </button>
</body>
</html>

CSS 如下:

.outer-circle {
  height: 250px;
  width: 250px;
  border-radius: 50%;
  background-color: blue;
}

.outer-circle:hover {
  background-color: red;
}

button {
  background-color: transparent;
  border: none;
}

最佳答案

像下面这样提供悬停样式,而不是 .outer-cirlce:hover

button:hover .outer-circle {
    background-color: red;
}

它会起作用的。试试吧

关于css - :hover works in firebug but not in firefox,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/43487030/

相关文章:

php - 无法让导航栏与 Wordpress 一起使用

css - 如何为一个 css 属性设置两个值?

css - Office 365 加载项在 Firefox 53 中被严重水平剪切

javascript - 如何在 chrome 上使 "&nbsp;"自动换行

html - 未指定 "sizes"时 SRCSET 加载大小不正确

css - 用 CSS 而不是图像重新创建这个图案?

angularjs - 如何将列右对齐?

css - 需要 Firefox 标记的 css hack

javascript - 检查 userinput 是否是 XUL 中的有效 URI

html - 删除 Firefox 选择框底部和右侧的黑线