在HTML文件中,如果我希望浏览器显示特殊符号,例如>
,我可以使用特殊的转义字符序列>
,浏览器会自动将其转换为>
.
但如果我不希望它被转移到>
怎么办?如果我碰巧希望字符序列以纯文本显示怎么办?
我的动画目前正在以方形运动移动。但是,我希望它从屏幕的左侧移动到右侧,然后在无限循环中再次返回。有人能帮忙吗?
.animation {
width: 10px;
height: 10px;
background-color: red;
position: relative;
animation-name: example;
animation-duration: 4s;
}
@keyframes example {
0% {
background-color: red;
left: 0px;
top: 0px;
}
25% {
background-color: red;
left: 200px;
top: 0px;
}
50% {
background-color: red;
left: 200px;
top: 200px;
}
75% {
background-color: red;
left: 0px;
top: 200px;
}
100% {
background-color: red;
left: 0px;
top: 0px;
}
}
Run Code Online (Sandbox Code Playgroud)
<div class="animation"></div>
Run Code Online (Sandbox Code Playgroud)