4 回答

TA贡献1982条经验 获得超2个赞
作为背景图片显示,然后写CSS样式,将背景图片居中显示就可以了。
样式是这样的;
#div{background:url('图片路径') center;}
这样的话就可以满足要求。

TA贡献1829条经验 获得超9个赞
你是要显示通栏导航的效果把?CSS完全可以实现:
将banner外面加个DIV,调用样式类nav,然后设置banner为1000像素宽,nav的设置自动:
【CSS部分】
<style>
.nav{width:auto;height:30px;background:url(img/bg.jpg) center center no-repeat;}
.banner{width:1000px;height:30px;margin:0 auto;}
.banner ul{width:1000px;height:30px;}
.banner ul li{width:100px;height:30px;float:left;}
</style>
【网页结构】
<div class="nav">
<div class="banner">
<ul>
<li>导航<li>
<li>导航<li>
<li>导航<li>
<li>导航<li>
<li>导航<li>
<ul>
</div>
</div>
这样就可以实现这个效果了

TA贡献1712条经验 获得超3个赞
其实应该很好解决,之所以下面被遮住是因为 z index只算他的父级 ,你的.nav没有定义position:relitive;z-index:3; 那他里面的子元素再怎么写也不可能比洗面的banner层级大。试试吧、
1 | .nav{ position :relitive; z-index : 3 ;} |
添加回答
举报