简体   繁体   English

CSS将不会链接到我的HTML

[英]css won't link with my html

This is my html: 这是我的html:

<!DOCTYPE html>   
<html>
<head>
<title>  </title>

<link rel="stylesheet" type="text/css" href="style.css">
<link rel="bootstrap" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css" integrity="sha384-BVYiiSIFeK1dGmJRAkycuHAHRg32OmUcww7on3RYdg4Va+PmSTsz/K68vbdEjh4u"             crossorigin="anonymous">
</head>
<body background="bgroundpic.jpg">
<div id="top" style="background-color: #F6F6F6"
<h1> This is a website</h1>
</div>
</body>
</html> 

This is my CSS: 这是我的CSS:

 html { 
     background: bgroundpic.jpg no-repeat center center fixed; 
     height: 100%;
     width: 100%;
}

body {
     font-family: 'Noto Sans', sans-serif;
     margin: 0 auto;
     height: 100%;
     width: 100%;
     background-color: blue

}

h1 {
    text-align: centre;
    vertical-align: middle;
    line-height: 90px;
    color: green;
}

.top{
    height: 70%;
    position 
}

My css is called style.css and it is in a sub-folder named css 我的css称为style.css ,它位于名为css的子文件夹中

You answered it yourself, saying your css file lives inside a css directory. 您自己回答了该问题,并说您的css文件位于css目录中。

So the path to that file should be: 因此,该文件的路径应为:

<link rel="stylesheet" type="text/css" href="css/style.css">

Tryusing ~ or / or ../ 尝试使用~/../

<link rel="stylesheet" type="text/css" href="/style.css">

or 要么

<link rel="stylesheet" type="text/css" href="~/style.css">

or 要么

<link rel="stylesheet" type="text/css" href="../style.css">

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM