我创建了一个文本滑动动画,它有一个固定文本(SM)和两个'LI',它们将相互滑动和替换(ART和allART)。我需要的是SMallART的“all”尺寸更小。
body {
width: 50%;
height: 50%;
position: fixed;
background-color: #F2F2F2;
}
.content {
width: 537px;
font-size: 62px;
line-height: 80px;
font-family: 'Muli';
color: #FE642E;
height: 100px;
position: absolute;
top: 50%;
left: 50%;
margin-top: -40px;
margin-left: 130px;
}
.visible {
float: left;
font-weight: 800;
overflow: hidden;
height: 80px;
}
p {
display: inline;
float: left;
margin: 0;
}
ul {
margin-top: 0;
padding-left: 101px;
text-align: left;
list-style: none;
animation: 6s linear 0s normal none infinite change;
-webkit-animation: 6s linear 0s normal none infinite change;
-moz-animation: 6s linear 0s normal none infinite change;
-o-animation: 6s linear 0s normal none infinite change;
}
ul li {
line-height: 80px;
margin: 0;
}
@-webkit-keyframes opacity {
0% {
opacity: 0;
}
50% {
opacity: 1;
}
100% {
opacity: 0;
}
}
@keyframes opacity {
0% {
opacity: 0;
}
50% {
opacity: 1;
}
100% {
opacity: 0;
}
}
@-webkit-keyframes change {
0% {
margin-top: 0;
}
15% {
margin-top: 0;
}
25% {
margin-top: -40px;
}
35% {
margin-top: -60px;
}
45% {
margin-top: -80px;
}
55% {
margin-top: -80px;
}
65% {
margin-top: -80px;
}
75% {
margin-top: -60px;
}
85% {
margin-top: -40px;
}
100% {
margin-top: 0;
}
}
@keyframes change {
0% {
margin-top: 0;
}
15% {
margin-top: 0;
}
25% {
margin-top: -40px;
}
35% {
margin-top: -60px;
}
45% {
margin-top: -80px;
}
55% {
margin-top: -80px;
}
65% {
margin-top: -80px;
}
75% {
margin-top: -60px;
}
85% {
margin-top: -40px;
}
100% {
margin-top: 0;
}
}
<link href='http://fonts.googleapis.com/css?family=Muli' rel='stylesheet' type='text/css'>
<div class="content">
<div class="visible">
<p>
SM
</p>
<ul>
<li>ART</li>
<li>allART</li>
</ul>
</div>
</div>
那么,如何只减少“全部”文字大小。
答案 0 :(得分:1)
尝试定义父div(用于一般段落样式)和子div(用于特定段落样式),并且您可以实现所需的功能,试试这个:
<强> HTML 强>
<div class="big-text">sm<div class="small-text">all</div>art</div>
<强> CSS 强>
.full-text {
display:inline;
font-size:22px;
}
.small-text {
display:inline;
font-size:10px;
}
Jsfiddle :