<!DOCTYPE html>
<html lang="pt-br">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta name="author" content="Milena Carecho">
<title>Mudança de cor de texto quando entra em outra div</title>
<link rel="stylesheet" type="text/css" href="style.css">
</head>
<body>
<section>
<span class="sliding">
<span>DESAFIO</span>
<span>30</span>
<span>DIAS</span>
<span>CSS</span>
<span> - </span>
<span>DESAFIO</span>
<span>30</span>
<span>DIAS</span>
<span>CSS</span>
</span>
<div class="wrapper">
<span class="sliding">
<span>DESAFIO</span>
<span>30</span>
<span>DIAS</span>
<span>CSS</span>
<span> - </span>
<span>DESAFIO</span>
<span>30</span>
<span>DIAS</span>
<span>CSS</span>
</span>
</div>
</section>
</body>
</html>
HTML
格式化
支持Emmet,输入 p 后按 Tab键试试吧!
<head> ... </head>
<body>
</body>
CSS
格式化
body
{
margin: 0;
padding: 0;
}
section
{
width: 100%;
height: 100%;
background: #eaffae;
box-sizing: border-box;
overflow: hidden;
position: absolute;
}
.wrapper
{
height: 100%;
width: 50%;
background: #f55757;
overflow: hidden;
color: #eaffae;
position: absolute;
top: 0;
left: 0;
border-right: 2px solid #262626;
}
.sliding
{
position: absolute;
top: 50%;
white-space: nowrap;
font-size: 12em;
line-height: 220px;
overflow: hidden;
font-family: "arial black";
animation: animate 20s linear infinite;
}
@keyframes animate
{
0%
{
transform: translate(0, -50%);
}
100%
{
transform: translate(-50%, -50%);
}
}
JS
格式化