我創建了一個div並懸停,我希望背景顏色變成紅色。當我在Firefox中查看它並將鼠標懸停在div上時,什麼都沒有發生。我可以在Firebug中檢查它,並強制懸停類 - 這是有效的!但是爲什麼它在瀏覽器中不能正常工作呢?:懸停在firebug中工作,但不在firefox中
<!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;
}
基於這些信息,我會說最有可能的塊級段落元素偷了鼠標,當然p:hover沒有任何樣式。雖然我不記得它的工作方式,但有點奇怪。 – Christopher
刪除它將起作用的按鈕標籤。 –
是的,我會說這個按鈕是輸入類型提交的補充 - 輸入不包含嵌套元素(僅文本) - 這是我的直覺 –