下面我提到了html和css。但是当我在浏览器中打开它时,背景颜色的css属性和其他没有显示任何期望图像的属性。
HTML代码
<html>
<head>
<title>Home Page One </title>
<meta http-equiv="Content-Type" content="type/html" charset="utf-8" />
<link href="home1.css" type="text/css" />
</head>
<body>
<header class="headerpart">
<img src="images.jpg"/>
</header>
</body>
</html>
CSS属性
body
{
background:#CCCCCC;
color:#000000;
font-size:12px;
font-family:"Times New Roman", Times, serif;
font-style:normal;
margin:0px auto;
}
.headerPart
{
background:#00CCFF;
margin:0px auto;
width:1120px;
height:30px;
}
当我在浏览器中运行此html时,它只显示图像需要背景和外观的css概率。当我检查html时,浏览器显示找不到css属性..
我正在寻找解决这个问题的方法..
答案 0 :(得分:3)
CSS类是区分大小写的。您的html中有class="headerpart"
,但您的CSS会显示.headerPart
并带有国会大厦P
。改变一个或另一个,你应该看到你想要的行为。
答案 1 :(得分:0)
将rel =“stylesheet”添加到您的链接代码中,如下所示:
<link rel="stylesheet" href="home1.css" type="text/css" />