CSS:marginÊôÐÔ±¸Íü
²Î¿¼×ÊÁÏ£ºhttp://www.blueidea.com/tech/web/2007/4546.asp£¬ÓÉdzÈëÉîÂþ̸marginÊôÐÔ - ÍøÒ³ÖÆ×÷ - À¶É«ÀíÏë
Ö±½ÓÉÏ´úÂ룺
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>aaa</title>
<style type="text/css">
html { }
body { margin:0px; }
</style>
</head>
<body>
<div id="div1" style="width:500px; height:500px;background:#fff000;margin:20px 0px -300px 0px;">
<!--ÕâÀïµÄtop 10px±ê¼ÇΪa£¬ÏÂÃæµÄtop 12px±ê¼ÇΪb£¬Ó°Ïìdiv1µÄÊÇabÁ½ÖµÓиºÊýÈ¡ºÍ¡¢ÎÞ¸ºÊýÈ¡×î´óÖµ£¬leftºÍtopÀíÂÛÉÏÒ»Ñù£¬Î´²âÊÔ-->
<div style="width:200px; height:200px; background:#ccc;margin:20px 10px 0px 10px;" id="div1_1"></div>
<div style="width:50px; height:50px; background:#ff0000;margin:10px 10px 0px 10px;" id="div1_2"></div>
</div>
<div id="div2" style="width:500px;height:100px;background:#fffff0;margin:100px 0px 0px 0px;"></div>
<!--margin to 100ÊÜdiv1µÄÓ°Ï죬div1µÄbottom marginֵΪ-300£¬¸ß500-300Ϊ200£¬div2Ó¦¸Ã³öÏÖÔÚdiv1µÄ¸ß200µÄµØ·½
£¬ÒòΪtop100£¬ËùÒÔÔÙÍùÏÂÒÆ¶¯100£¬ËùÒÔbottomºÍrightÊÇ¶ÔÆäËû·ÇÖû»ÔªËØÓÐÓ°Ï죬rightδ×ö²âÊÔ-->
<!--Öû»ÔªËØ£¨replaced element£©Ö÷ÒªÊÇÖ¸img£¬input£¬textarea£¬select£¬objectµÈÕâÀàĬÈϾÍÓÐCSS¸ñʽ»¯Íâ±í·¶Î§
µÄÔªËØ-->
</body>
</html>
ÏÔʾЧ¹ûÈçÏ£º
Ïà¹ØÎĵµ£º
½ñÌìÏÂÎ磬ÊÖÍ·ÉÏûʲôÊÂ×ö£¬ÓÚÊǾÍÉÏÍø²é¿´×ÊÁÏ£¬¿´µ½ºÜ¶àÈËдµÄYUI CompressorµÄʹÓ÷½·¨£¬´óÖÂдµÄ¶¼²»Ïêϸ£¬ÓÚÊÇ×Ô¼ºÀ´×ö¸ö×ܽᡣ
£¨1£©Ê×ÏÈÀ´¿´Ï£¬ÎªÊ²Ã´ÒªÑ¹Ëõjs»òcssÎļþ£¿
JS/CSSÎļþ´ó£¬Óû§·ÃÎÊÕ¾µãµÄʱºòÐèÒªÏÂÔØJS/CSSµÄʱ¼ä³¤¾Í»á¸Ð¾õÂý£¬ÓеÄÉõÖÁÓÉÓÚCSSµÄÎļþ¶øÔì³ÉÒ³Ãæ³õʼ´ò¿ªºÜÁèÂÒ¡ ......
In this specification, the expression collapsing margins means that adjoining margins (no non-empty content, padding or border areas or clearance separate them) of two or more boxes (which may be next to one another or nested) combine to form a single margin.
In CSS 2.1, horizontal margins ne ......
Ê×ÏÈÊÇHTML´úÂë:
<div id="outer">
<div id="leftFrame" style="width: 20%;">
<div style="height: 30%" id="packageListFrame" title="All Packages" >
Package list goes here
</div>
&n ......
ÈÃleftµÄ¸ß¶ÈµÈÓÚ centerµÄ¸ß¶È..........
<div id=left></div>
<div id=center></div>
<script type="text/javascript">
document.getElementById("left").style.height = document.getElementById("center").offsetHeight + "px";
</script> ......