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>
ÏÔʾЧ¹ûÈçÏ£º
Ïà¹ØÎĵµ£º
jQuery, MooTools, Prototype µÈÓÅÐãµÄ JavaScript ¿ò¼ÜÓµÓи÷ÖÖÇ¿´óµÄ¹¦ÄÜ£¬°üÀ¨»æÖÆ Web ͼ±í£¬Ê¹ÓÃÕâЩ¿ò¼ÜÒÔ¼°ÏàÓ¦²å¼þ£¬ÎÒÃÇ¿ÉÒԷdz£ÇáËɵØʵÏÖÇúÏßͼ£¬Ô²±ýͼ£¬Öù״ͼµÈ Web ͼ±íµÄ»æÖÆ£¬¶ø²»±ØÏóÒÔÍùÄÇÑùͨ¹ý¸´Ô Flash ¼¼ÊõʵÏÖ¡£±¾ÎĽéÉÜÁË9¸öÓÅÐãµÄ»ùÓÚ JavaScript Óë CSS µÄ Web ͼ±í¿ò¼Ü¡£ 1. Flot Flot ......
Èç¹ûIE6ºÍIE7ÏÔʾ¶¼Õý³££»»ðºüҲûÓÐÎÊÌ⣻¼ì²é´úÂëҲûÓÐÎóʧ£»¾ÍÊÔÊÔ¼ÓÉÏÕâ¶Î´úÂë
IE8Ä¿Ç°»¹²»Îȶ¨£¬ÌÚѶÊ×Ò³ÀûÓÃIE7µÄÄÚºËÀ´äÖȾIE8£¬´úÂëÈçÏÂ:
<meta http-equiv="X-UA-Compatible" content="IE=EmulateIE7" /> ......
clip:rect(ÉÏ£¬ÓÒ£¬Ï£¬×ó) Ëĸöµã×ø±ê
<img src="1.jpg" style=" clip:rect(0£¬30£¬10£¬10);"/>
´Ë·½·¨²»ÊʺϼôÇб³¾°
±³¾°Ê¹ÓÃ
style="background-image:url(bg.jpg); background-position:20px 0px;"
kground-position:
1.¶¨Î»·½·¨ left center ºáÏò ×ÝÏò
2.ÇÐÈ¡ ºáÏòpx ×ÝÏòpx
²»ÊʺÏÆ ......
ÈÃ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> ......