我有一个简单的div。
<div id="sample"></div>
我使用下面的代码使边框透明:
var sample_div = document.getElementById('sample');
sample_div.style.borderColor = 'transparent';
当鼠标悬停时,我希望将div的边框变为蓝色。以下是我的CSS代码:
div:hover { border: 1px solid blue; }
#sample:hover{
border: 1px solid blue;
border-color: blue;
}
我的CSS代码不起作用。当鼠标指针悬停时,它不会改变颜色。它保持透明。为什么?
#sample_div:hover{
翻译为#sample:hover {
。 - Tushar