<div class="squish-text">
<span>壓</span><span>縮</span><span>文</span><span>字</span><span>效</span><span>果</span>
</div>
body {
background: #282c34;
display: flex;
justify-content: center;
align-items: center;
height: 100vh;
margin: 0;
}
.squish-text {
font-size: 5rem;
display: inline-block;
cursor: pointer;
}
.squish-text span {
display: inline-block;
transition: transform 0.5s cubic-bezier(0.25, 1.5, 0.5, 1);
margin: 0 5px;
}
.squish-text span:hover {
transform: scale(1.2, 0.8); /* 水平方向放大,垂直方向壓縮 */
}
.squish-text span:nth-child(1) {
color: #e74c3c; /* 紅色 */
}
.squish-text span:nth-child(2) {
color: #f39c12; /* 橙色 */
}
.squish-text span:nth-child(3) {
color: #27ae60; /* 綠色 */
}
.squish-text span:nth-child(4) {
color: #3498db; /* 藍色 */
}
.squish-text span:nth-child(5) {
color: #9b59b6; /* 紫色 */
}
.squish-text span:nth-child(6) {
color: #e67e22; /* 橙紅色 */
}
This Pen doesn't use any external CSS resources.
This Pen doesn't use any external JavaScript resources.