html - 过渡完成后,显示div

标签 html css

亲爱的 Stackoverflow 读者,

仅使用 CSS3,如何在转换完成后显示 div。

这是我正在处理的 HTML 片段

<div class="biography">
      <p>Title</p>
      <p id="moreBio">This is a test. This is a test. This is a test. This is a test. This is a test. This is a test. This is a test. This is a test. This is a test.</p>
</div>

这是我正在使用的 CSS3 片段

.biography {
    width: 100px;
    height: 40px;
    float: left;
    margin: 5px;
    background: #3399FF;
    color: #ffffff;
    box-shadow: 2px 2px 10px rgba(0, 0, 0, 0.5);
    position: relative;
    right: 5%;
    font-weight: bold;
    font-size: 15px;
    text-align: center;
    padding: 10px;
    border-radius: 5px;
    opacity: 0.4;
    transition: all 0.5s ease;
    -webkit-transition: all 0.5s ease;
    -o-transition: all 0.5s ease;
    -moz-transition: all 0.5s ease;
}
.biography:hover {
    width: 200px;
    height: 600px;
    margin: 10px 10px 0px -100px;
    opacity: 1;
    background: #7C7C7C;
}
#moreBio {
    opacity: 0;
    transition: opacity 0.5s ease;
    -webkit-transition: opacity 0.5s ease;
    -o-transition: opacity 0.5s ease;
    -moz-transition: opacity 0.5s ease;
}
#moreBio:hover {
    opacity: 1;
}

我希望在转换完成后显示#moreBio,我该怎么做呢?

非常感谢您。

最佳答案

#moreBio中添加一个transition-delay,等于.biography的过渡时间,让出现在时触发.biography 悬停在上面。

#moreBio {
    opacity: 0;
    transition: opacity 0.5s 0.5s ease;
    -webkit-transition: opacity 0.5s 0.5s ease;
    -o-transition: opacity 0.5s 0.5s ease;
    -moz-transition: opacity 0.5s 0.5s ease;
}
.biography:hover  #moreBio {
    opacity: 1;
}

关于html - 过渡完成后,显示div,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/24977568/

相关文章:

javascript - 图片淡入淡出($未定义)

html - Bootstrap 3 网格调整大小问题

javascript - HTML Select 在搜索中出现问题

css - 在 SASS/SCSS 中过度嵌套选择器在实践中有多糟糕?

html - 为什么关闭 1 像素边框会在固定位置标题和 Flex 增长的情况下产生 75 像素溢出?

html - 悬停时双线

javascript - 如何使用JavaScript/Jquery在 anchor 中显示动态生成的代码

javascript - 如何使用 NodeJS 在 Web 应用程序中从 Azure Blob 存储提供 HTML 文件?

jquery - 获取所有 child 的高度并将其应用于 parent

html - 导航栏中的图标不保持内联