我正在尝试在网页的四个侧面放置 4 个文本。所有这些文本都将具有行间距以将所有字符彼此分开。一次,悬停的行间距将减少到正常,使它们出现在中间。
--------------------------
| top text |
| |
| v v|
| e e|
| r r|
| t other content t|
| i i|
| c c|
| a a|
| l l|
| bottom text |
--------------------------
到目前为止,我已经写了这个:
.spaced-text{
color:white ;
text-shadow: 2px 2px 4px #000000;
letter-spacing: 100px;
width: 100%;
height: 42px;
text-transform: uppercase;
text-decoration: none;
text-align: center;
}
.spaced-text:hover{
text-decoration: none;
color: #CE640E;
animation: spaced-in 1s ease-out forwards;
}
@keyframes spaced-in{
0%{
letter-spacing: 100px;
opacity: 0.1;
}
20%{
letter-spacing: 80px;
opacity: 0.2;
}
40%{
letter-spacing: 60px;
opacity: 0.4;
}
60%{
letter-spacing: 40px;
opacity: 0.6;
}
80%{
letter-spacing: 20px;
opacity: 0.8;
}
100%{
letter-spacing: 1px;
opacity: 1;
}
}
.vertical-text-right{
text-decoration: none;
transform: rotate(-90deg);
float: right;
position: absolute;
margin-top: 0px;
margin-right: 0px;
padding-right: 50%;
text-align: center;
}
.vertical-text-left{
transform: rotate(90deg);
float: left;
position: absolute;
margin-top: 0px;
margin-right: 0px;
padding-right: 50%;
text-align: center;
}
a{
text-decoration: none;
}
<html>
<body>
<div style="float:left"><h1 class="vertical-text-right spaced-text"> <a href="#">Right Text</a></h1></div>
<div style="float:left"><h1 class="vertical-text-left spaced-text"> <a href="#">Left Text</a></h1></div>
<center><div class="text-center"><h1 class="spaced-text text-center"> <a href="#"> Top Text</a></h1></div>
</center>
<div style="width:100%; height: 100px;">
<center><i>Some other content</i></center></div>
<center><div class="text-center"><h1 class="spaced-text text-center"> <a href="#">Bottom Text</a></h1></div>
</center>
</body>
</html>
PS: 文本间距不响应,这是另一个问题。