Jac*_*ray 1 html css html5 title css3
你可以<abbr>用CSS淡化元素的标题吗?
我知道如何设计标题,我想知道是否有可能为它设置动画.
我的意思是,当你将鼠标悬停在元素上时,会突然出现.我想让它慢慢淡入,并想知道它是否可能在CSS中.
的jsfiddle
<abbr title="I want this to fade in">Hover over Me!</abbr>
Run Code Online (Sandbox Code Playgroud)
abbr {
position: relative;
border:none;
}
abbr:hover::after {
position: absolute;
height:auto;
width:475px;
bottom: -50px;
color:black !important;
left: 0;
display: block;
padding: 1em;
background: gold;
border-radius:2px;
content: attr(title);
-o-transition:.5s;
-ms-transition:.5s;
-moz-transition:.5s;
-webkit-transition:.5s;
}
Run Code Online (Sandbox Code Playgroud)
例如,您需要使用转换为数字的值opacity.DEMO
abbr:hover::after {
opacity:1;
}
abbr::after {
position: absolute;
opacity:0;
height:auto;
width:475px;
bottom: -50px;
color:black !important;
left: 0;
display: block;
padding: 1em;
background: gold;
border-radius:2px;
content: attr(title);
-o-transition:.5s;
-ms-transition:.5s;
-moz-transition:.5s;
-webkit-transition:.5s;
transition:1s;/* DO NOT FORGET THE REGULAR ONE */
}
Run Code Online (Sandbox Code Playgroud)
在演示中,伪已经存在但是是半透明的,直到你悬停 <abbr>