简体   繁体   English

CSS正文背景颜色不起作用?

[英]CSS Body background-color doesn't work?

I'm assuming this is a super simple issue, but I'm staring blankly at my screen trying to figure this out. 我假设这是一个非常简单的问题,但我茫然地盯着我的屏幕试图解决这个问题。 I'm trying to change some things of the body of my html document, but nothing changes? 我正在尝试更改我的html文档正文中的一些内容,但没有任何变化?

 @charset "utf-8"; body { background-color: aqua; } 
 <!DOCTYPE html> <html> <head> <title>Statistics</title> <link rel="stylesheet" type="text/css" href="main.css"> <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/css/bootstrap.min.css" integrity="sha384-1q8mTJOASx8j1Au+a5WDVnPi2lkFfwwEAa8hDDdjZlpLegxhjVME1fgjWPGmkzs7" crossorigin="anonymous"> </head> <body> <button type="button" class="btn btn-lg btn-default-outline">View All</button> </body> </html> 

If i change the background image, it works fine. 如果我更改背景图像,它工作正常。 Any idea why? 知道为什么吗? Could it be the bootstrap css? 它可能是bootstrap css吗?

if you add !important after "aqua", does it work? 如果你在“aqua”之后添加!important,它有用吗?

@charset "utf-8";
body
{
    background-color: aqua !important;
}

If yes, then there's probably some other styles, like the bootstrap.css interfering. 如果是,那么可能还有其他一些样式,比如bootstrap.css干扰。

You also should put your custom css file after the bootstrap-css. 您还应该在bootstrap-css 之后放置自定义css文件。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM