html - 显示 CSS 文件中的图像

标签 html css

我正在开发一个应用程序并尝试使用 CSS 表中的 @URL.Content 显示标题图像,就像这样

.jumbotron .header-image {
    min-width:1024px;
    min-height:267px;
    background-image: url('@Url.Content("~/Content/images/header.png")');

图像在那里,但我得到的只是标题应该在的方框。我只是简单地展示它

     <div class="jumbotron">
           <div class="jumbotron header-image"></div>
     </div>

我哪里错了?

编辑

@Jesse 这就是全部:

.jumbotron {
  text-align: center;
  background-color: transparent;
  background-image: -webkit-gradient(linear, left top, left bottom, color-stop(0%,#f5f5f5), color-stop(100%,#e5e5e5)); /* Chrome,Safari4+ */
  background-image: -webkit-linear-gradient(top, #f5f5f5 0%,#e5e5e5 100%); /* Chrome 10+,Safari 5.1+ */
}
.jumbotron .btn {
  font-size: 21px;
  padding: 14px 24px;
}

.jumbotron .header-image {
    min-width:1024px;
    min-height:267px;
    background-image: url('@Url.Content("~/Content/images/header.png")');
  }

<div class="jumbotron">
    <div class="jumbotron header-image"></div>
</div>

我不知道为什么这不起作用,它看起来是正确的

最佳答案

我相信您与两个背景样式声明发生冲突,一个在超大屏幕中,另一个在 .header-image 中。有没有你想使用的原因:

<div class="jumbotron">
     <div class="jumbotron header-image"></div>
</div>

而不仅仅是:

<div class="jumbotron">
     <div class="header-image"></div>
</div>

关于html - 显示 CSS 文件中的图像,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/30442531/

相关文章:

javascript - AngularJS 按钮指令不起作用

css - 轮播中文本的背景颜色消失了,为什么?

html - flex-basis auto和0(零)的区别

html - Angular 组件如何使用用户定义的样式表?

webkit - Safari-webkit-transition-property : animating scale and/or background-size

html - 以下选择器表tr :first-child>span. class>a 的特殊性是什么?

html - 如何从细节元素中删除元素符号?

javascript - 当开发人员工具打开 IE11 时,网站表现不同

javascript - ng-model 可以附加到样式标签吗?

Chrome 中的 CSS 调整大小句柄和鼠标事件