如何在Bootstrap 5中放置背景颜色白色?

发布于 2025-02-13 00:40:23 字数 940 浏览 1 评论 0原文

我需要一些帮助,以将我的背景投资组合颜色放入白色。我试图通过放置全局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>&copy; 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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

以歌曲疗慰 2025-02-20 00:40:23

简单地看一下文档就足够了。这是链接:

https://getbootstrap.com/docs/docs/5.0/comporities/utilities/utilities/utilities/utackergnet/

显然,您可以用:

.bg-light

这意味着您必须将组件包装到:

<div className="bg-light">
  ...
</div>

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:

.bg-light

This means you have to wrap your component into:

<div className="bg-light">
  ...
</div>
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文