部分内的背景图像不显示
back ground image inside section not displaying
我无法显示任何图片或图片链接。我尝试使用多个
链接和图片。什么都不管用。同一文件夹中的所有文件,并且 CSS
连接的。我不知道该怎么办了。
HTML
<!doctype html>
<head>
<meta name="viewport" content="width=device-width,initial-scale=1">
<meta charset= "utf-8">
<title> portfolio website </title>
<link rel="stylesheet" href="stylesheet.css">
</head>
<html>
<body>
<section class:"main">
<div id="container">
<div class:"header">
<nav>
<a href="index.html">Home</a>
<a href="About.html">About</a>
<a href="Portfolio.html">Portfolio</a>
</nav>
</div>
</div>
</section>
</body>
</html>
CSS
Body{
margin: 0;
padding: 0;
height: 100%;
width: 100%;
}
.main{
height: 100%;
width: 100%;
margin: auto;
background-image: url("rockets.jpg");
background-repeat: none;
background-size: cover;
}
错误:
<section class:"main">
<div class:"header">
<nav>
<a href:"index.html">Home</a>
<a href:"About.html">About</a>
<a href:"Portfolio.html">Portfolio</a>
</nav>
</div>
</section>
答案:
<section class="main">
<div class="header">
<nav>
<a href="index.html">Home</a>
<a href="About.html">About</a>
<a href="Portfolio.html">Portfolio</a>
</nav>
</div>
</section>
不是“:”你必须使用“=”
我无法显示任何图片或图片链接。我尝试使用多个 链接和图片。什么都不管用。同一文件夹中的所有文件,并且 CSS 连接的。我不知道该怎么办了。
HTML
<!doctype html>
<head>
<meta name="viewport" content="width=device-width,initial-scale=1">
<meta charset= "utf-8">
<title> portfolio website </title>
<link rel="stylesheet" href="stylesheet.css">
</head>
<html>
<body>
<section class:"main">
<div id="container">
<div class:"header">
<nav>
<a href="index.html">Home</a>
<a href="About.html">About</a>
<a href="Portfolio.html">Portfolio</a>
</nav>
</div>
</div>
</section>
</body>
</html>
CSS
Body{
margin: 0;
padding: 0;
height: 100%;
width: 100%;
}
.main{
height: 100%;
width: 100%;
margin: auto;
background-image: url("rockets.jpg");
background-repeat: none;
background-size: cover;
}
错误:
<section class:"main">
<div class:"header">
<nav>
<a href:"index.html">Home</a>
<a href:"About.html">About</a>
<a href:"Portfolio.html">Portfolio</a>
</nav>
</div>
</section>
答案:
<section class="main">
<div class="header">
<nav>
<a href="index.html">Home</a>
<a href="About.html">About</a>
<a href="Portfolio.html">Portfolio</a>
</nav>
</div>
</section>
不是“:”你必须使用“=”