div中没有​​显示背景图像

时间:2018-02-01 11:02:42

标签: html css html5

我正在使用VS Code在angular 5项目中工作。 我无法显示图像,但正在下载,因为它位于Chrome浏览器开发人员工具的网络选项卡中。这意味着网址是正确的。

.start {
    background: #222 url('/assets/images/Untitled-1.png') center center no-repeat;
    color: white;
    height: 100%;
    text-align: center;
}

现在为父div增加了宽度和高度,仍然没有显示图像;(

<div class="row">
  <div class="col" style="height:100%;width:100%;">
    <div class="start"></div>
  </div>
</div>

已下载但未显示。我在哪里弄错了?

我正在关注YouTube tutorial

1 个答案:

答案 0 :(得分:0)

如果您使用背景属性设置图像,则需要在其中包含内容以增加元素高度或自行设置特定高度。

相关问题