CSS样式表没有链接到html

时间:2016-08-29 03:04:08

标签: html css

所以我正在尝试使用样式表作为我的html页面的背景图像。它只是没有联系或只是没有工作。 (是的html和css文件都在同一个目录/文件夹中)。

这是我用过的代码

<html>
<head>
<link href="stylesheet1.css" rel="stylesheet" type="text/css">
<body>
<center> <p style="border:1px solid white; padding:15px; color:blue;      font-family:courier; font-size:200%;"> Welcome
</body>
</head>
</html>

然后样式表代码本身就包含了这个。甚至在链接类型中,我尝试使用/ png / image。

body {
        background-image: url("image-name-here.png");
        backgound-repeat: no-repeat;
        background-position: center top;
}

是的,我试过用头替换标签体。

1 个答案:

答案 0 :(得分:1)

您在background-repeat中遇到拼写错误,拼写为backgound-repeat。此外,如果您还没有,则HTML中需要有<body></body>标记。

更新 HTML

<!DOCTYPE html>
<html>
<head>
<link href="stylesheet1.css" rel="stylesheet" type="text/css">
...
</head>
<body>
...
</body>
</html>

<强> CSS

修复样式表中的错误

body {
   background-image: url("image-name-here.png");
   background-repeat: no-repeat;
   background-position: center top;
}
相关问题