我试图使文字闪烁在反应中。我完全是个反应新手。到目前为止,我试着把文字变成红色。密码在这里,
import React from "react";
import { Component } from "react";
class DisplayMyName extends Component {
render(){
const mystyle = {
color:"red",
}
return (
<div>
<h1 style={mystyle}>
Deepesh
</h1>
</div>
);
}
}
export default DisplayMyName;如何通过使用CSS属性使其闪烁,就像我在上面的代码中尝试的那样?
发布于 2022-08-11 10:22:20
尝试一下这个npm包
https://www.npmjs.com/package/react-blink-text
或将以下css包含在单独的文件中
blink {
-webkit-animation-name: blink;
-webkit-animation-iteration-count: infinite;
-webkit-animation-timing-function: cubic-bezier(1.0,0,0,1.0);
-webkit-animation-duration: 1s;
} 发布于 2022-10-17 15:59:07
<html>
<body>
<style>
.blink {
animation: blinker .75s linear infinite;
color: red;
font-family: sans-serif;
}
@keyframes blinker {
50% {
opacity: 0;
}
}
</style>
<p class="blink"> This is an example of blinking text using CSS. </p>
</body>
</html>https://stackoverflow.com/questions/73318943
复制相似问题