当你所切的网页类似于这种情况的时候,左侧有投影是深绿色,右侧是另一种颜色而且还是修饰过得形状。
中间网页部分宽度固定,两侧自适应浏览器宽度。
现在有个问题是一般两侧的纹络或者颜色一致,这样能直接设置背景色或者背景图片平铺。现在是两侧图片形状不一致,应该怎么切呢?
我个人的解决思路:
在整个网页容器切图按照常用规律切固定宽度(如红线显示),然后居中。头部和底部的自适应浏览器宽度用table(分为一行两列)加上绝对定位position:absoulute;用z-index为付,放在下面实现右50%是一种背景平铺,左50%为一种背景平铺。
1、利用table的百分比,分成一行两列,每个列为50%,实现在一行两列之内平铺不同背景宽度总和为100%。
2、利用定位 和z-index放置在背景下面。
<div class="head">
<table width="100%" border="0" >
<tr>
<td width="50%" class="bl"></td>
<td width="50%" class="br"></td>
</tr>
</table>
<div class="header"> <a href="#"><img src="images/logo.jpg" height="107" width="199" /></a>
<div class="hright">
<p class="mt p1">置业顾问:霍云兰 联系电话:15611111111 所在门店:海淀区南小庄</p>
<p class="p2">登录次数:19 累计下载:12 暂存架:6<a href="#">去打包</a></p>
</div>
</div>
</div>
.head{ width:100%; height:107px; }
.head table{z-index:-1; position:absolute; top:0; height:107px; left:0;}
.head .header{ width:1001px; margin:0 auto;color:#585f02; font-size:14px;}
.br{background:url(../images/desc_06.jpg) repeat-x; }
.bl{background:url(../images/headbg.jpg) repeat-x; }
html代码
<div class="foot mt2">
<table border="0" width="100%">
<tr>
<td width="50%" class="td_l"></td>
<td width="50%" class="td_r"></td>
</tr>
</table>
<div class="footer"> <a href="#"><img src="images/logo_b.jpg" height="38" width="152" /></a>
<div class="hright">版权所有 安悦·家</div>
</div>
</div>
上面图片foot例子css
/*foot*/
.foot{ width:100%; height:38px; line-height:38px;}
.foot table{ position:absolute; z-index:-1; height:38px; left:0;}
.foot .td_l{ background:#014715;}
.foot .td_r{background:#c3d600;}