为什么我的CSS包装器不适用于我的HTML代码
好的,我正在做一个关于我计算课上的几个朋友的笑话,我遇到了一个问题,我的CSS代码中的包装器不适用于该网页。包装器适用于站点上的其他页面,但不适用于此页面,以下是HTML代码:为什么我的CSS包装器不适用于我的HTML代码,html,css,Html,Css,好的,我正在做一个关于我计算课上的几个朋友的笑话,我遇到了一个问题,我的CSS代码中的包装器不适用于该网页。包装器适用于站点上的其他页面,但不适用于此页面,以下是HTML代码: <html> <head> <link href="main.css" rel="stylesheet" type="text/css> <title>Ways that George is physically bette
<html>
<head>
<link href="main.css" rel="stylesheet" type="text/css>
<title>Ways that George is physically better than Adam</title>
</head>
<body>
<div class=" wrapper ">
<h1> There are many ways that George is physically better than Adam </h1>
<div class="article ">
<ul>
<li>George isn't as fat as Adam.</li>
<li>George has better hair than Adam.</li>
<li>George has a manly assortment of stubble.</li>
<li>George is just more attractive than Adam.</li>
</ul>
<div class="littlearticle ">
<p> <a href="George is better than adam.html "> Click here to return to the homepage. </a> </p>
</div>
</div>
</div>
</html>
“text/css”后面缺少一个结束双引号
您的许多
CSS
规则无效:
CSS语法是:
rule: property;
而且永远不会:
rule; property;
因此,您可以更正:
文本对齐;左代码>按文本对齐:左代码>
背景色;白色代码>由背景色:白色代码>
填充;8px代码>通过填充:8px代码>
除此之外,您的CSS链接无效,您应该关闭“
:
您还错过了结束标记
还有一点,您的css属性应该是小写的:
文本对齐:左;
应为文本对齐:左;
这不会影响css,但这是一个很好的实践。四个小错误:
1
<link href="main.css" rel="stylesheet" type="text/css>
您几乎没有上面提到的语法错误
body {text-align: left;}
.wrapper{
width:40em; text-align:left;
margin-left: 150px; margin-right: 150px;
padding: 8px;
}
h1 {
color:red;
background-color:white;
font-family:tahoma;
border-top:red 2px double;
border-bottom: red 2px dashed;
padding: 8px;
}
.article {
color:blue;
font-family:consolas;
font-size:medium;
background-color:yellow;
padding:8px;
}
.littlearticle {
color:black;
font-family:consolas;
font-size:medium;
background-color:red;
padding: 8px;
}
还请更正html页面中的引用,如下所示
<link href="main.css" rel="stylesheet" type="text/css">
这是为我工作的指南非常感谢大家,它现在可以工作了!非常感谢,为我愚蠢的错误感到抱歉!
<link href="main.css" rel="stylesheet" type="text/css>
<link href="main.css" rel="stylesheet" type="text/css">
body {text-align: left;}
.wrapper{
width:40em; text-align:left;
margin-left: 150px; margin-right: 150px;
padding: 8px;
}
h1 {
color:red;
background-color:white;
font-family:tahoma;
border-top:red 2px double;
border-bottom: red 2px dashed;
padding: 8px;
}
.article {
color:blue;
font-family:consolas;
font-size:medium;
background-color:yellow;
padding:8px;
}
.littlearticle {
color:black;
font-family:consolas;
font-size:medium;
background-color:red;
padding: 8px;
}
<link href="main.css" rel="stylesheet" type="text/css">