如何在Bootstrap 5中放置背景颜色白色?
我需要一些帮助,以将我的背景投资组合颜色放入白色。我试图通过放置全局CSS来做到这一点,但是在页面的两边,我都有黑色背景,我无法更改它。
return (
<>
<Navbar />
<main className="main">
{title && (
<h1 className="bg-light">
{title}
</h1>
)}
{children}
</main>
{/* - {new Date().getFullYear()} */}
{
footer && (
<footer className="bg-dark text-light text-center">
<div className="container p-1">
<h6>© Juan M. Grehuello Portfolio</h6>
<p>2022. All rights reserved</p>
</div>
</footer>
)
}
</>
);
我的CSS就像:
.main {
background-color: white;
padding: 2px;
margin-left: 107px;
margin-right: 107px;
}
I need some help to put my background portfolio color in white. I tried to do it by putting a global css but on both sides of the page I have a black background and I can´t change it.
return (
<>
<Navbar />
<main className="main">
{title && (
<h1 className="bg-light">
{title}
</h1>
)}
{children}
</main>
{/* - {new Date().getFullYear()} */}
{
footer && (
<footer className="bg-dark text-light text-center">
<div className="container p-1">
<h6>© Juan M. Grehuello Portfolio</h6>
<p>2022. All rights reserved</p>
</div>
</footer>
)
}
</>
);
And my css is like:
.main {
background-color: white;
padding: 2px;
margin-left: 107px;
margin-right: 107px;
}
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
简单地看一下文档就足够了。这是链接:
https://getbootstrap.com/docs/docs/5.0/comporities/utilities/utilities/utilities/utackergnet/
显然,您可以用:
这意味着您必须将组件包装到:
A simple look at the documentation would have been enough. Here is the link:
https://getbootstrap.com/docs/5.0/utilities/background/
Apparently, you can set the background color with:
This means you have to wrap your component into: