-1

我对编码有点陌生,非常感谢我遇到的问题的一些帮助。我试图在 div 中引用图像,但是当我通过浏览器检查时,图像没有显示。我正在关注本教程:http ://www.youtube.com/watch?v=j4kTLpezHDI&list=PL52E0F0A024E913AE 。

CSS:

.banner {
   background: url(../img/city-bg.jpg) no-repeat;
    width: 695px;
    height: 271px;
}

html:

    <!doctype html>
<html>
<head>
    <meta charset="UTF-8">
    <title>Black + White</title>
    <link rel="stylesheet" type="text/css" "style.css">
</head>
<body>

<div class="container_12">
    <header>
    <h1>Black + White</h1>
    <nav>
        <ul>
        <li><a href="#">Home</a></li>
        <li><a href="#">Our Services</a></li>
        <li><a href="#">How We Work</a></li>
        <li><a href="#">Testimonials</a></li>
        <li><a href="#">Work Examples</a></li></ul>
    </nav>
    <div class="banner grid_10">
    <p>Some slick phrase would go in here to sum up what the business actually does and stands for.</p>
    </div>
    <div class="grid_2"></div>
</header>
<div class="main">
    <div class="grid_5">
        <h1>Services we offer</h1>
        <p>"Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.</p>
        <p> Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum."</p>
        <p><a href="#" class="button">Read more</a></p>
    </div>
    <div class="grid_5">
        <h1>How we work</h1>
        <p>"Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.</p>
        <p> Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum."</p>
        <p><a href="#" class="button">Read more</a></p>
    </div>
    <div class="grid_2">
        <blockquote>
            <p>Clean, elegant typography
            matched with sharp lines
            and precise spacing leads
            to a professional look
            and feel</p>
        </blockquote>
    </div>
</div>
<footer><p><strong>black+white themes via </strong><a href="http://themeforest.net">Themeforest</a></p></footer>
</div>

</body>
</html>
4

2 回答 2

3
<link rel="stylesheet" type="text/css" "style.css">
--------------------------------------^------------

You're missing href:

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

starting with HTML + CSS

于 2013-09-14T15:13:22.860 回答
0

您可能在这里缺少链接标记中的href

我强烈建议你使用元素浏览器检查工具来检查这种类型的错误,它们很容易使用,它们会让你摆脱很多麻烦。在您的浏览器上下载、安装和使用代码元素检查工具:Firefox 的 Firebug、Opera 的 DragonFly,或使用 Chrome 的内置工具。您可以转到 HTML 代码中的该元素,并检查代码是否正确使用。您还可以即时进行临时 HTML/JS/CSS 更改以对其进行测试。这通常在 Web 开发中很有用,可以检查代码是否在浏览器中按需要轻松执行,或者对测试用例和事物进行更改。

于 2013-09-14T15:21:10.087 回答