【发布时间】:2014-09-19 05:05:57
【问题描述】:
我想模仿这个网站的白色主要内容区域 -> http://kibart.com/。内容居中,但白色区域一直延伸到浏览器的左侧。你是如何实现这个效果的?
【问题讨论】:
-
向该网站发送电子邮件并询问他们的代码
我想模仿这个网站的白色主要内容区域 -> http://kibart.com/。内容居中,但白色区域一直延伸到浏览器的左侧。你是如何实现这个效果的?
【问题讨论】:
基本上有两个元素创建了您所指的那个一直向左延伸的区域。第一个是<div id="main-content">,另一个是<div class="left-filler">。 <div id="main-content"> 是 <div> 包含所有主要内容,这些是在样式表中分配给它的样式:
#main-content {
background-color: #fff;
position: relative;
width: 804px;
padding: 30px 0 55px 0;
float: left;
}
<div class="left-filler">是一个绝对定位的<div>,背景为白色,出现在主内容<div>的左侧,其作用是隐藏箭头图案图像。这些是在样式表中分配给它的样式:
.left-filler {
background-color: #fff;
width: 4000px;
height: 100%;
position: absolute;
overflow: hidden;
bottom: 0;
right: 500px;
z-index: -20;
}
我希望这会有所帮助。
【讨论】: