gpt4 book ai didi

javascript - 使用 Bootstrap 时如何更改 body 的颜色?

转载 作者:太空宇宙 更新时间:2023-11-03 20:10:41 24 4
gpt4 key购买 nike

我正在尝试对 Bootstrap 进行编程,当我打算更改我的 body 的颜色时,只需使用:

body {
background-color: #eba;
width: 100%;
height: 100%;
}

它没有用,所以我的问题是如何在使用 Bootstrap 时设置任何样式?我查看了开发人员的工具,发现 background-color: #eba; 被忽略并被默认的 Bootstrap body color 取代,这是为什么? Bootstrap Default body color 不应该被忽略而不是我的吗?(我可能把两个问题合二为一了,所以请原谅我)。

相关 HTML

<body>
<div class="container">
<div class="row">
<div class="col-lg-3 col-md-3 col-sm-6 col-xs-12">
<h4>Column 1</h4>
<p>
Lorem ipsum dolor sit amet, consectetur adipisicing elit. Porro exercitationem provident explicabo ipsa consequuntur, quidem dolorem perferendis veritatis facilis fugiat deleniti natus quod laboriosam eum incidunt consequatur cumque voluptates. Repellat.
</p>
</div>
<div class="col-lg-3 col-md-3 col-sm-6 col-xs-12">
<h4>Column 2</h4>
<p>
Lorem ipsum dolor sit amet, consectetur adipisicing elit. Porro exercitationem provident explicabo ipsa consequuntur, quidem dolorem perferendis veritatis facilis fugiat deleniti natus quod laboriosam eum incidunt consequatur cumque voluptates. Repellat.
</p>
</div>
<div class="col-lg-3 col-md-3 col-sm-6 col-xs-12">
<h4>Column 3</h4>
<p>
Lorem ipsum dolor sit amet, consectetur adipisicing elit. Porro exercitationem provident explicabo ipsa consequuntur, quidem dolorem perferendis veritatis facilis fugiat deleniti natus quod laboriosam eum incidunt consequatur cumque voluptates. Repellat.
</p>
</div>
<div class="col-lg-3 col-md-3 col-sm-6 col-xs-12">
<h4>Column 4</h4>
<p>
Lorem ipsum dolor sit amet, consectetur adipisicing elit. Porro exercitationem provident explicabo ipsa consequuntur, quidem dolorem perferendis veritatis facilis fugiat deleniti natus quod laboriosam eum incidunt consequatur cumque voluptates. Repellat.
</p>
</div>
</div>
</div>
</body>
</html>

相关 CSS

body {
background-color: #eba;
}

最佳答案

在包含 bootstrap.css 或 bootstrap.min.css 之后放置自定义 css

或者在你的 CSS 中添加 !important 关键字

<style type="text/css">
body{background: #eba !important;}
</style>

关于javascript - 使用 Bootstrap 时如何更改 body 的颜色?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/34250725/

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