现在我想实现一个功能:当页面变大的时候让输入框中的placeholder滚动显示,实现第一步滚动显示的时候就出错了,根本没有效果
前端我不太懂
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Input Animation Demo</title>
<link rel="stylesheet" href="style.css"> <!-- 引入外部CSS文件 -->
</head>
<body>
<div class="input-container">
<input type="text" class="animated-input" placeholder="请输入文字...hahahahahhahhah 呵呵">
</div>
</body>
</html>
/* 基础样式 */
.input-container {
display: flex;
justify-content: center;
margin-top: 50px;
}
.animated-input {
padding: 10px;
font-size: 16px;
border: 2px solid #ccc;
border-radius: 4px;
transition: all 0.3s ease;
}
@keyframes example {
from {
transform: translateX(100%);
}
to {
transform: translateX(-100%);
}
}
.animated-input::placeholder {
animation-name: example;
animation-duration: 1s;
}