亚洲在线久爱草,狠狠天天香蕉网,天天搞日日干久草,伊人亚洲日本欧美

為了賬號安全,請及時綁定郵箱和手機立即綁定

這個是什么原因?

這樣的代碼為什么mainbody標簽背景圖是藍色的,但是也通過了??

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml">

<head>

<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />

<title>無標題文檔</title>

<style type="text/css">

* {

? ? margin:0;

padding:0;

}

#wrap {

background:#00C;

margin:0 auto;

width:960px;

}

#header {

background:#FF3300;

width:100%;

}

#mainbody {

? ?background:#FC0;

width:100%;

overflow:hidden; ?

}

.left {

width:800px;

height:200px;

background:#000;

float:left;

}

.right {

width:140px;

height:500px;

background:#690;

float:right;

}

#footer {

background:#639;

width:100%;

}

</style>

</head>


<body>

<div id="wrap">

? <div id="header">頭部</div>

? <div id="mainbody">

? ? <div class="left"></div>

? ? <div class="right"></div>

? </div>

? <div id="footer">版權部分</div>

</div>

</body>

</html>


正在回答

1 回答

background-color 屬性用來定義元素的背景顏色。

body {background-color: #b0c4de;}

CSS中,顏色值通常以以下方式定義:

十六進制 - 如:#ff0000????它的三位顏色簡寫為 #f00

RGB - 如:rgb(255,0,0)

顏色名稱 - 如:red

默認 - transparent,透明之意。如果一個元素沒有指定背景色,那么背景就是透明的。

inherit 從父元素繼承背景顏色,這個在IE上存在兼容問題。


0 回復 有任何疑惑可以回復我~
#1

Peyton_B 提問者

非常感謝!
2015-10-17 回復 有任何疑惑可以回復我~

舉報

0/150
提交
取消
網頁布局基礎
  • 參與學習       214662    人
  • 解答問題       1833    個

讓你精通CSS中三大定位機制,徹底掌握網頁布局的相關知識

進入課程

這個是什么原因?

我要回答 關注問題
微信客服

購課補貼
聯系客服咨詢優惠詳情

幫助反饋 APP下載

慕課網APP
您的移動學習伙伴

公眾號

掃描二維碼
關注慕課網微信公眾號