我正在开发一个应用程序并尝试使用 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/