divstyle=\"width:500px;height:500px;border:solid1px#900;\"
divstyle=\"width:100px;height:100px;background-color:#900;position:absolute;z-index:11;margin-top:10px;margin-left:10px;\"1/div
divstyle=\"width:100px;height:100px;background-color:#090;position:absolute;z-index:12;margin-top:120px;margin-left:10px;\"2/div
divstyle=\"width:100px;height:100px;background-color:#009;position:absolute;z-index:13;margin-top:10px;margin-left:120px;\"3/div
divstyle=\"width:100px;height:100px;background-color:#990;position:absolute;z-index:14;margin-top:120px;margin-left:120px;\"4/div
/div
要用margin-left,margin-right,margin-right,margin-bottom属性,而不是直接用top,left,right,bottom这些属性,前者是对父元素的,后者是对整个窗体的。还有z-index的值必须是不一样的,如果是一样的的话,那就表示它们在同一层面上,会相互拥挤。
仅供参考!呵呵 |