gpt4 book ai didi

css - 如何将屏幕右侧的文本移动到屏幕左侧

转载 作者:行者123 更新时间:2023-12-05 06:17:36 25 4
gpt4 key购买 nike

我想做一个游戏。如何让 h1 标签在 reactjs 中从左向右移动?

import React from 'react';

const Hello = (props) => (<React.StrictMode><h1 className = "App">Hello {props.name}</h1></React.StrictMode>);

export default Hello;

最佳答案

我创建了这个解决方案:codepen :

const App = () => {
return (
<div className="wrapper">
<p className="marquee">Hello, world!</p>
</div>
);
}

ReactDOM.render(
<App />,
document.getElementById('root')
);

CSS文件:

body{ 
overflow: hidden;
}
p{
position: absolute;
white-space: nowrap;
animation: floatText 5s infinite alternate ease-in-out;
}

@-webkit-keyframes floatText{
from {
left: 00%;
}

to {
/* left: auto; */
left: 100%;
}
}

关于css - 如何将屏幕右侧的文本移动到屏幕左侧,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/61578168/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com