代码如下:
<
div
style
="background-color: #FFFF99; height: 63px; margin: 0 auto; width: 650px;"
>
< ul style ="background-color: #88f8f8; left: 5px; margin: 0; padding: 0; position: relative; top: 20px;" >
< li style =" background-color: #FF6633;cursor: pointer;display: block;float: left;height: 21px;
list-style: none outside none;margin: 0 2px 0 0;overflow: hidden;padding: 0;width: 318px;" ></ li >
< li style =" background-color: #FF6633;cursor: pointer;display: block;float: left;height: 21px;
list-style: none outside none;margin: 0 2px 0 0;overflow: hidden;padding: 0;width: 318px;" ></ li >
</ ul >
</ div >
< hr >
< div style ="background-color: #FFFF99; height: 63px; margin: 0 auto; width: 650px;" >
< ul style ="background-color: #88f8f8; left: 5px; margin: 0; padding: 0; position: relative; top: 20px; width: 644px;" >
< li style =" background-color: #FF6633;cursor: pointer;display: block;float: left;height: 21px;
list-style: none outside none;margin: 0 2px 0 0;overflow: hidden;padding: 0;width: 318px;" ></ li >
< li style =" background-color: #FF6633;cursor: pointer;display: block;float: left;height: 21px;
list-style: none outside none;margin: 0 2px 0 0;overflow: hidden;padding: 0;width: 318px;" ></ li >
</ ul >
</ div >
< ul style ="background-color: #88f8f8; left: 5px; margin: 0; padding: 0; position: relative; top: 20px;" >
< li style =" background-color: #FF6633;cursor: pointer;display: block;float: left;height: 21px;
list-style: none outside none;margin: 0 2px 0 0;overflow: hidden;padding: 0;width: 318px;" ></ li >
< li style =" background-color: #FF6633;cursor: pointer;display: block;float: left;height: 21px;
list-style: none outside none;margin: 0 2px 0 0;overflow: hidden;padding: 0;width: 318px;" ></ li >
</ ul >
</ div >
< hr >
< div style ="background-color: #FFFF99; height: 63px; margin: 0 auto; width: 650px;" >
< ul style ="background-color: #88f8f8; left: 5px; margin: 0; padding: 0; position: relative; top: 20px; width: 644px;" >
< li style =" background-color: #FF6633;cursor: pointer;display: block;float: left;height: 21px;
list-style: none outside none;margin: 0 2px 0 0;overflow: hidden;padding: 0;width: 318px;" ></ li >
< li style =" background-color: #FF6633;cursor: pointer;display: block;float: left;height: 21px;
list-style: none outside none;margin: 0 2px 0 0;overflow: hidden;padding: 0;width: 318px;" ></ li >
</ ul >
</ div >
在ff下显示和在ie6下显示的效果不一样。
ff下的两个排版一致,ie6下上下两个排版不一。
主要原因在:ul 的style="width: 644px", ie6对设置了width后才对position: relative;作用。否则不作用。
ff截图
ie截图