【发布时间】:2015-06-21 03:20:49
【问题描述】:
这个问题是my previous question 的后续问题。
我有一些来自this website 的样式,用于创建带下划线效果的幻灯片,请参阅此jsfiddle 上的示例。
我之前的问题是询问如何调整这一点,以便该行从右到左进入,并在文本顶部,请参阅此 jsfiddle 上的示例。
我的下一步是将这两个都添加到一个元素中,因此一条线在底部从左到右滑入,另一条在顶部从右到左滑入。
当我尝试将这两个加在一起时,它似乎只显示最上面的一个,请看这个jsfiddle。
我的问题是如何将顶部幻灯片和底部幻灯片添加到元素中?
.cmn-t-underline {
position: relative;
color: #ff3296;
}
.cmn-t-underline:after {
display: block;
position: absolute;
left: 0;
bottom: -10px;
width: 0;
height: 10px;
background-color: #2E9AFE;
content: "";
-webkit-transition: all 0.3s;
-moz-transition: all 0.3s;
-o-transition: all 0.3s;
transition: all 0.3s;
height:2px;
}
.cmn-t-underline:hover {
color: #98004a;
}
.cmn-t-underline:hover:after {
width: 100%;
height:2px;
}
.cmn-t-overline {
position: relative;
color: #ff3296;
}
.cmn-t-overline:after {
display: block;
position: absolute;
right: 0;
top: -10px;
width: 0;
height: 10px;
background-color: #2E9AFE;
content: "";
-webkit-transition: all 0.3s;
-moz-transition: all 0.3s;
-o-transition: all 0.3s;
transition: all 0.3s;
height:2px;
}
.cmn-t-overline:hover {
color: #98004a;
}
.cmn-t-overline:hover:after {
width: 100%;
height:2px;
}
<h1 class="cmn-t-underline cmn-t-overline">Test</h1>
【问题讨论】:
标签: html css css-transitions