css高级应用 重构原理
时间:2011-02-01 来源:hbhmlxx
2个DIV,3个DIV,5个DIV实现水平垂直均居中显示一个宽50px,高200px的正十字架.(转载)
2个DIV实现
.div_a { width:50px; background:#a40000; position:absolute; left:50%; top:50%; margin:-100px 0 0 -25px}
.div_b { width:200px; background:#a40000; position:absolute; left:50%; top:50%; margin:-25px 0 0 -100px}
3个DIV实现
.div_a { width:200px; background:#a40000; margin-top:75px }
.div_b { width:50px; background:#a40000; margin:-125px 0 0 75px }
.div_c { width:200px; width:200px; position:absolute; left:50%; top:50%; margin:-100px 0 0 -100px }
5个DIV实现
.div_a { width:200px; width:200px; position:absolute; background:#a40000; left:50%; top:50%; margin:-100px 0 0 -100px }
.div_b,.div_c,.div_d,.div_e{ width:75px; background:#fff }
.div_b,.div_d { float:left}
.div_c,.div_e { float:right}
.div_b,.div_c { margin-bottom:50px}
2个DIV实现
.div_a { width:50px; background:#a40000; position:absolute; left:50%; top:50%; margin:-100px 0 0 -25px}
.div_b { width:200px; background:#a40000; position:absolute; left:50%; top:50%; margin:-25px 0 0 -100px}
3个DIV实现
.div_a { width:200px; background:#a40000; margin-top:75px }
.div_b { width:50px; background:#a40000; margin:-125px 0 0 75px }
.div_c { width:200px; width:200px; position:absolute; left:50%; top:50%; margin:-100px 0 0 -100px }
5个DIV实现
.div_a { width:200px; width:200px; position:absolute; background:#a40000; left:50%; top:50%; margin:-100px 0 0 -100px }
.div_b,.div_c,.div_d,.div_e{ width:75px; background:#fff }
.div_b,.div_d { float:left}
.div_c,.div_e { float:right}
.div_b,.div_c { margin-bottom:50px}
相关阅读 更多 +