【问题标题】:Why is my image not displaying in my HR? [duplicate]为什么我的图像没有显示在我的 HR 中? [复制]
【发布时间】:2016-01-06 11:49:13
【问题描述】:

我的 Meteor 应用中有这个 HTML:

<template name='layout'>
  {{> banner}}
  {{> yield}}
</template>

<template name="banner">
  <h1 class="monospaceboldsmallcap chocolatefont">Platypi of the World Unite! (Duckbilled, that is)</h1>
  <hr/>
</template>

...还有这个 CSS:

hr {
  background:url('/images/dbp.jpg') repeat-x top left;
  border: 0;
}

图像在 /public/images/dbp.jpg 中,但它根本不显示 - 事实上,以前的“plain jane”hr 也不再显示。

我在这里遗漏了什么或做错了什么?

【问题讨论】:

  • 您可能需要设置一个高度值。
  • 您也可以尝试在斜线前多加一个点:'./images/dbp.jpg'。

标签: html css meteor meteor-blaze spacebars


【解决方案1】:

您需要在hr 标签中定义高度。

hr{border:1px solid red;height:30px;background:url(https://i.stack.imgur.com/VJ2Se.png?s=32&amp;g=1)}
&lt;hr&gt;

【讨论】:

  • 你用的那张照片很奇怪;-)
  • 我认为这会让你感觉更紧密。 :P
猜你喜欢
  • 2021-10-10
  • 1970-01-01
  • 2016-07-12
  • 2021-03-31
  • 1970-01-01
  • 2018-09-08
  • 1970-01-01
  • 1970-01-01
  • 2013-04-08
相关资源
最近更新 更多