【发布时间】:2018-09-04 14:00:50
【问题描述】:
我不知道,但由于某些原因,转换似乎不起作用。我正在测试这个谷歌浏览器。
[data-title] {
position: relative;
margin: 100px;
}
[data-title]:hover:before {
transform: translate(-50%, 0);
width: 18px;
height: 6px;
left: 50%;
margin-top: 0px;
top: 100%;
opacity: 1;
pointer-events: auto;
-webkit-transition: all 0.25s;
transition: all 0.25s;
content: '';
position: absolute;
z-index: 10;
box-sizing: border-box;
border-left: 8px solid transparent;
border-right: 8px solid transparent;
border-bottom: 10px solid #00204e;
}
[data-title]:hover:after {
transform: translate(-50%, 0);
left: calc(50%);
margin-top: 10px;
top: 100%;
opacity: 1;
pointer-events: auto;
-webkit-transition: all 0.25s;
transition: all 0.25s;
font-weight: normal;
text-shadow: none;
background: #00204e;
border-radius: 4px;
color: #fff;
content: attr(data-title);
padding: 10px;
position: absolute;
white-space: normal;
width: max-content;
font-size: 12px;
font-family: 'Helvetica Neue';
line-height: normal;
max-width: 150px;
text-align: left;
height: auto;
display: inline-block;
}
<span class="dijitButtonContents" id="saveButton" data-title="Save as draft"><span id="saveButton_label">Save</span></span>
任何人都可以帮助我哪里出错或我错过了什么?
我什至尝试将转换时间设置为 +1 秒,但仍然反映不一样。
【问题讨论】:
-
但是你没有悬停的
:before和:after的样式 -
是的,因为这是我只在悬停时需要的工具提示。
-
所以你的代码完全按照你写的。
-
您要制作什么动画?
-
@Pete 我正在尝试为悬停时出现的工具提示设置动画。
标签: css hover transition mousehover