css - 动画 CSS 工具提示 ( :after selector)

标签 css animation tooltip

我正在为我正在处理的网站实现工具提示,我发现了 this solution但我想不出一种方法来制作动画。

我想做的是向下滑动工具提示。

代码如下。感谢您的帮助。

HTML:

<a href="#" title="This is some information for our tooltip." class="tooltip">
  <span title="More">CSS3 Tooltip</span>
</a>


CSS:

<style type="text/css">
.tooltip{
    display: inline;
    position: relative;
}

.tooltip:hover:after{
    background: #333;
    background: rgba(0,0,0,.8);
    border-radius: 5px;
    bottom: 26px;
    color: #fff;
    content: attr(title);
    left: 20%;
    padding: 5px 15px;
    position: absolute;
    z-index: 98;
    width: 220px;
}

.tooltip:hover:before{
    border: solid;
    border-color: #333 transparent;
    border-width: 6px 6px 0 6px;
    bottom: 20px;
    content: "";
    left: 50%;
    position: absolute;
    z-index: 99;
}
</style>

最佳答案

CSS 属性:动画。使所有内容都具有绝对定位,然后使用动画属性为工具提示设置动画。 https://developer.mozilla.org/en-US/docs/Web/Guide/CSS/Using_CSS_animations?redirectlocale=en-US&redirectslug=CSS%2FTutorials%2FUsing_CSS_animations

关于css - 动画 CSS 工具提示 ( :after selector),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/18938635/

相关文章:

java - Android:动画 - 如何确定 xml 文件动画的结束并在 java 中启动 AlphaAnim?

css - 带有 CSS 的悬停工具提示的 z-index

css - 如何在一个div中创建多个列

html - 如何使 3 列响应?

javascript - 通过单击循环停止动画(问题)

Android:Android 资源中是否有可用的原生/默认动画?

javascript - Popper.js 下拉菜单/工具提示的初始位置错误

delphi - 隐藏窗口阴影

javascript - 如何制作固定第一列和固定列左侧垂直文本的表格

html - CSS 选择器反转 :focus + label logic