<html><body><form>用户名: <input type="text" tabindex="1" />密码: <input type="text" tabindex="2" />地址: <input type="text" tabindex="3" />性别: <input type="text" tabindex="4" />年龄: <input type="text" tabindex="5" /></form><div style="position: absolute;width:500;height:500;background-color:red; z-index:0"> <!-- 不要写成z-index=2 -->"第一层</div><div style="position: absolute;width:600;height:400;background-color:green; z-index:-2">第二层</div><div style="position: absolute;width:300;height:300;background-color:blue; z-index:5">第三层</div></body></html>
tabindex定义了按tab键获取光标的先后顺序~!
z-index定义了层的层次关系,在层之上还是在层之下.值大的在上面。重要说明:在某些情况下设置z-index没有效果,原因是需要设置position:absolute;为绝对定位才可以。
这种情况发生的条件有三个:(div层调整zindex属性在IE中无效原因分析及解决方法)
1、父标签 position属性为relative;
2、问题标签无position属性(不包括static);
3、问题标签含有浮动(float)属性。