我有这个样本:
代码HTML:
<div class="main">
<header>
<div class="bg"></div>
</header>
</div>
CODE CSS:
.main{
width: 100%;
position: relative;
}
header{
text-align: center;
margin: 0 auto;
overflow: hidden;
position: relative;
}
.bg{
background:url(../images/hero_large.jpg);
width: 2560px;
height: 1354px;
background-size: 2560px 1354px;
background-repeat: no-repeat;
position: relative;
margin-left: -1280px;
left: 50%;
}
我想从此link
复制标题我试图复制这个标题,但有些东西是bine.Totul CSS代码是从那里复制的,但在我的例子中不起作用。
你能告诉我什么是遗失的,什么不是? ...我再说一遍CSS代码
提前致谢!
答案 0 :(得分:0)
所以我尝试修改代码并将背景更改为红色并且工作正常。我认为你的形象的路径是问题
.main{
width: 100%;
position: relative;
}
header{
text-align: center;
margin: 0 auto;
overflow: hidden;
position: relative;
}
.bg{
background:red;
width: 2560px;
height: 1354px;
background-size: 2560px 1354px;
background-repeat: no-repeat;
position: relative;
margin-left: -1280px;
left: 50%;
}
&#13;
<div class="main">
<header>
<div class="bg"></div>
</header>
</div>
&#13;