css - 当我将鼠标悬停在我的 div 上时,如何让我的文本消失?

标签 css html hover

这是 HTML 正文中唯一的内容:

    <div id="box">
        <p id="text"> Enter The Disco! </p>
    </div>

这是我与问题相关的 CSS:

#box:hover{
    -webkit-transform:rotate(360deg);
    opacity:1;
    background-image:url("Logo.jpg");
    width:428px;
    height:208px;
    font-size:38px;
}
#text:hover{
    padding:18% 0% 0% 0%;
    color:red;
}

我想做的是,当我将鼠标悬停在 div 上时,让里面的文本消失。我该怎么做?它已经旋转并改变了背景,但我只想让文字在它完成动画后消失。

最佳答案

您可以使用 color CSS attribute而不是让它不可见,只是让它透明,这应该具有相同的效果:

#text:hover {
  /* other rules */
  color: transparent;
}

关于css - 当我将鼠标悬停在我的 div 上时,如何让我的文本消失?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/22466150/

相关文章:

Firefox:盒子模型的错误解释?

css - 更改 svg 路径的颜色

javascript - 将鼠标悬停在 svg 上以影响其他元素属性不起作用

css - 悬停时的直线动画(不完整)

css - 制作一个 div 链接并在悬停时更改内容

html - 宽度比父级 div 大 100%

css - 如何使 div 背景颜色具有一定的大小,内容具有绝对位置?

python - 将多个 HTML 文件作为单独的工作表导入 Excel 中

javascript - 如何让两行文字换行

css - 让:hover transition complete even when not hovering on element