我有一個簡單的html文件,我想應用一些css來改變外觀,但css沒有被應用到我的內容。爲什麼我的css沒有被應用?
我知道我應該把css放在外部文件中,但我現在只是從書中的示例中學習。
這裏是html。任何人都可以幫忙嗎?提前感謝您!
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>Insert title here</title>
<style type="text/css">
.content p{
background-color:#C0C0C0;
padding: 3px;
}
.heading p{
display: inline;
background-color:black;
color: white;
font-weight:bold;
padding:3px;
}
</style>
</head>
<body>
<div id="heading">
<p>Heading A</p>
<p>Heading B</p>
<p>Heading C</p>
</div>
<div id="content">
<p>Paragraph A</p>
<p>Paragraph B</p>
<p>Paragraph C</p>
</div>
</body>
</html>
'.heading'選擇一個類別爲「heading」的項目。你希望'#標題'通過ID選擇一個項目。 – ptd 2014-11-02 13:53:21