我的React应用在角落有很小的空间
我为背景添加了一个图像,但是角落里有很小的空间(请参阅我附加的图片)。
我为此应用了以下代码。
我的另一个网站并没有显示这样。 如何删除这个微小的空白?
function Home() {
return(
<div //className='home-background'
style={{
backgroundImage: `url(${background})`,
backgroundRepeat: 'no-repeat',
backgroundSize: 'cover',
height: '100vh',
width: '100vw',
// backgroundPosition: 'center',
}}
>
<div>Home</div>
</div>
)
}
export default Home;
I've added an image for my background, but there is tiny space at the corner (Please see the pic I attached).
I applied the below code for this.
My other website doesn't show like this.
How can I remove this tiny white space?
function Home() {
return(
<div //className='home-background'
style={{
backgroundImage: `url(${background})`,
backgroundRepeat: 'no-repeat',
backgroundSize: 'cover',
height: '100vh',
width: '100vw',
// backgroundPosition: 'center',
}}
>
<div>Home</div>
</div>
)
}
export default Home;
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
尝试一下。
Try this.
我建议在CSS文件中设置以造型所有元素。
I recommend setting in the CSS file for styling all elements.