div#sidebar{}与#sidebar div{}的差别详细介绍

2021-03-10 10:20 jianzhan

拷贝编码
编码以下:

<!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⑻" />
<title>overflow特性用法</title>
<style type="text/css">
div#sidebar { background-color:blue;
}
#sidebar div{ background-color:red;
}
</style>
</head>
<body>
<div>
<div id="sidebar">我是蓝色
<div>我是鲜红色</div>
</div>
</div></div></body>
</html>