【发布时间】:2018-01-25 22:53:40
【问题描述】:
所以我尝试使用 img 标签在 html/css 中制作背景 img,但我的 img 标签不允许事物重叠,当我尝试使用 div 类元素时,它不会延伸到边缘即使宽度为 100% 的页面。这是我的css和html。
.backgroundImage {
background: url(/images/mainBackground.jpeg) top no-repeat;
width: 100%;
height: auto;
position: relative;
z-index: 0;
margin: 0 auto;
}
.img{
z-index:0;
}
.img-responsive{
height:auto;
width:100%
}
这是我尝试过的两种方法:
<img src="../images/mainBackground.jpeg" class="shadow-offset img-responsive"/>
<div class="backgroundImage">
除页脚之外的所有内容都以 div 结尾
我有容器,但它们都没有在任何容器中,因为它们在我使用容器之前从页面顶部开始。
【问题讨论】:
标签: html css twitter-bootstrap image