[英]body background color not showing?
我只有一個簡單的 .shtml 頁面:
<html>
<head>
<meta charset='utf-8'>
<meta content="IE=edge" http-equiv="X-UA-Compatible">
<meta content="width=device-width, initial-scale=1" name="viewport">
<link href="Stylesheets/main.css" rel="stylesheet">
<link href="Stylesheets/glicons.css" rel="stylesheet">
<link href="https://maxcdn.bootstrapcdn.com/bootstrap/3.2.0/css/bootstrap.min.css" rel="stylesheet">
<title>
Codepixl
</title>
</head>
<body>
<!--#include file="nav.html"-->
asdsd
<div id="Scripts">
<script src="http://code.jquery.com/jquery-latest.js"></script> <script src="Scripts/jquery.cookie.js"></script> <script src="Scripts/jquery-ui.min.js"></script> <script src="scripts/typed.js"></script> <script src="//codepixl.net/scripts/secret.js"></script>
</div>
</body>
</html>
和樣式表:
body{
background-color: #32CD32;
}
.loader {
position: fixed;
top: 50%;
left: 50%;
margin-top: -115px;
margin-left: -115px;
z-index: 9999;
}
但是背景顏色沒有顯示出來? 我試過使用 html,body{} 並使用 doctype 但沒有任何效果! 發生了什么?
編輯:我刪除了引導程序,它開始工作......也是這個頁面: http : //codepixl.net/indesx.shtml
編輯:我只需要將引導程序放在我的樣式表之前-_-
通過添加 `!important` 覆蓋 Bootstrap 的樣式
body{
background-color: #32CD32 !important;
}
評論您的 Bootstrap 包含並查看是否應用了正文。 您應該先嘗試使用最少的代碼進行測試,然后再添加一些東西。
如果這不起作用,您可以使用 Firefox 或 Chrome 中的檢查器來查看應用了哪些 CSS 效果。
您可能還想使用 Chrome 中的網絡檢查器來確定您的樣式表是否真的被下載了,或者鏈接是否不正確。
html {
height: 100%;
}
body {
background-color:#cccccc;
}
這對我有用。 如果沒有在 html 中設置高度,則 body 的 background-color 屬性根本不起作用。
你的身體有可能是 0px 的高度。 將height:100%
添加到您的體型中,看看是否有效。
嘗試
<body BGCOLOR=#E8FFE8>
這將 html 標簽設置為薄荷綠色
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.