简体   繁体   中英

css won't link with my html

This is my 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:

 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

You answered it yourself, saying your css file lives inside a css directory.

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">

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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