部分内部的背景图像不显示

时间:2017-08-13 14:26:06

标签: html css sections

我无法获得任何图片或照片链接。我尝试过使用多个 链接和图片。什么都行不通。同一文件夹中的所有文件和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;
    }

1 个答案:

答案 0 :(得分:1)

错:

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

NOT&#34;:&#34;你必须使用&#34; =&#34;