div+css(¶þ)
Ç°ÑÔ£ºCSS²¼¾ÖÓ봫ͳ±í¸ñ(table)²¼¾Ö×î´óµÄÇø±ðÔÚÓÚ£ºÔÀ´µÄ¶¨Î»¶¼ÊDzÉÓñí¸ñ£¬Í¨¹ý±í¸ñµÄ¼ä¾à»òÕßÓÃÎÞɫ͸Ã÷µÄGIFͼƬÀ´¿ØÖÆÎIJ¼¾Ö°æ¿éµÄ¼ä¾à£»¶øÏÖÔÚÔò²ÉÓòã(div)À´¶¨Î»£¬Í¨¹ý²ãµÄmargin,padding,borderµÈÊôÐÔÀ´¿ØÖÆ°æ¿éµÄ¼ä¾à¡£
(Ò») CSS2ºÐÄ£ÐÍ
ºÐÄ£ÐÍÖ÷Òª¶¨ÒåËĸöÇøÓò£ºÄÚÈÝ(content)¡¢±ß¿ò¾à(padding)¡¢±ß½ç(border)ºÍ±ß¾à(margin)¡£
(¶þ) ʵÀý½âÎö
#sample{
MARGIN: 10px 10px 10px 10px;
PADDING:20px 10px 10px 20px;
BORDER-TOP: #CCC 2px solid;
BORDER-RIGHT: #CCC 2px solid;
BORDER-BOTTOM: #CCC 2px solid;
BORDER-LEFT: #CCC 2px solid;
BACKGROUND: url(images/bg_poem.jpg) #FEFEFE no-repeat right bottom; COLOR: #666; TEXT-ALIGN: center; LINE-HEIGHT: 150%; WIDTH:60%; }
˵Ã÷ÈçÏ£º
l MARGINÊÇÖ¸²ãµÄ±ß¿òÒÔÍâÁôµÄ¿Õ°×£¬ÓÃÓÚÒ³±ß¾à»òÕßÓëÆäËü²ãÖÆÔìÒ»¸ö¼ä¾à¡£
"10px 10px 10px 10px"·Ö±ð´ú±í"ÉÏÓÒÏÂ×ó"(˳ʱÕë·½Ïò)Ëĸö±ß¾à£¬Èç¹û¶¼Ò»Ñù£¬¿ÉÒÔËõд³É"MARGIN: 10px;"¡£Èç¹û±ß¾àΪÁ㣬Ҫд³É"MARGIN: 0px;"¡£
×¢Ò⣺µ±ÖµÊÇÁãʱ£¬³ýÁËRGBÑÕÉ«Öµ0%±ØÐë¸ú°Ù·ÖºÅ£¬ÆäËûÇé¿öºóÃæ¿ÉÒÔ²»¸úµ¥Î»"px"¡£MARGINÊÇ͸Ã÷ÔªËØ£¬²»Äܶ¨ÒåÑÕÉ«¡£
l PADDINGÊÇÖ¸²ãµÄ±ß¿òµ½²ãµÄÄÚÈÝÖ®¼äµÄ¿Õ°×¡£ºÍmarginÒ»Ñù£¬·Ö±ðÖ¸¶¨ÉÏÓÒÏÂ×ó±ß¿òµ½ÄÚÈݵľàÀë¡£Èç¹û¶¼Ò»Ñù£¬¿ÉÒÔËõд³É"PADDING:0px"¡£µ¥¶ÀÖ¸¶¨×ó±ß¿ÉÒÔд³É"PADDING-LEFT: 0px;"¡£PADDINGÊÇ͸Ã÷ÔªËØ£¬²»Äܶ¨ÒåÑÕÉ«¡£
l BORDERÊÇÖ¸²ãµÄ±ß¿ò£¬"BORDER-RIGHT: #CCC 2px solid;"ÊǶ¨Òå²ãµÄÓұ߿òÑÕɫΪ"#CCC"£¬¿í¶ÈΪ"2px"£¬ÑùʽΪ"solid"Ö±Ïß¡£Èç¹ûÒªÐéÏßÑùʽ¿ÉÒÔÓÃ"dotted"¡£
l BACKGROUNDÊǶ¨Òå²ãµÄ±³¾°¡£·Ö2¼¶¶¨Ò壬Ïȶ¨ÒåͼƬ±³¾°£¬²ÉÓÃ"url(../images/bg_logo.gif)"À´Ö¸¶¨±³¾°Í¼Æ¬Â·¾¶£»Æä´Î¶¨Òå±³¾°É«"#FEFEFE"¡£"no-repeat"Ö¸±³¾°Í¼Æ¬²»ÐèÒªÖظ´£¬Èç¹ûÐèÒªºáÏòÖظ´ÓÃ"repeat-x",×ÝÏòÖظ´ÓÃ"repeat-y",Öظ´ÆÌÂúÕû¸ö±³¾°ÓÃ"repeat"¡£ºóÃæµÄ"right bottom;"ÊÇÖ¸±³¾°Í¼Æ¬´ÓÓÒϽǿªÊ¼¡£Èç¹ûûÓб³¾°Í¼Æ¬¿ÉÒÔÖ»¶¨Òå±³¾°É«BACKGROUND: #FEFEFE
l  
Ïà¹ØÎĵµ£º
ÍⲿÒýÓÃCSS
ÖÐ link
Óë@import
µÄÇø±ð
ÕâÁ½ÌìдÁËCSSÑùʽ£¬¾ßÌåÑо¿ÁËXHTML¼ÓÔØCSS
µÄ¼¸ÖÖ·½Ê½£¬ÆäÖÐÍⲿÒýÓÃCSS
·ÖΪÁ½ÖÖ·½Ê½link
ºÍ@import
¡£
±¾ÖÊÉÏ£¬ÕâÁ½ÖÖ·½Ê½¶¼ÊÇΪÁ˼ÓÔØCSS
Îļþ£¬µ«»¹ÊÇ´æÔÚ×Åϸ΢µÄ²î±ð¡£
* ²î±ð1£ºÀÏ×æ×ڵIJî±ð¡£link
ÊôÓÚXHTML±êÇ©£¬¶ø@import
ÍêÈ«ÊÇCSS
Ìá¹ ......
<div style="padding-top:5px;width:200px;height:15px;background-color:#ffeeee"> test </div>
ÒÔÉÏ´úÂëÔÚIEÖкÍfirefox»áÓв»Í¬µÄЧ¹û.×îÖ÷ÒªÔÒòÊÇfirefox½âÊÍpadding-topÓëIEµÄЧ¹û²»Í¬
fixfox¶ÔDIV×ܸ߶ÈÊÇpadding-top+heightµÄ,¶øIEÖÐ,padding-topÊÇ°üº¬ÔÚheightÖеÄ,
Òª½â¾öÕâÒ»¸öì¶Ü,¿ÉÒÔÀûÓÃ!imp ......
jQueryÌṩcss()µÄ·½·¨À´ÊµÏÖǶÈëʽ¸Ä±äÔªËØÑùʽ£¬css()·½·¨ÔÚʹÓÃÉϾßÓжàÑùÐÔ¡£ÆäÖÐÒ»ÖÖ½ÓÊÜÁ½¸öÊäÈë²ÎÊý£ºÑùʽÊôÐÔºÍÑùʽֵ£¬ËüÃÇÖ®¼äÓöººÅ·Ö¿ª¡£±ÈÈçÎÒÃÇÒª¸Ä±äÁ´½ÓÑÕÉ«£¬ÎÒÃÇ¿ÉÒÔʹÓÃÏÂÃæµÄ´úÂ룺$("#61dh a").css('color','#123456');
//ÕâÀïÑ¡ÔñÆ÷¡®$("#61dh a")¡¯±íʾIDΪ¡®#61dh¡¯µÄÔªËØϵÄËùÓÐÁ´½Ó¡£
//.css( ......
½ñÌìÏÂÎ磬ÊÖÍ·ÉÏûʲôÊÂ×ö£¬ÓÚÊǾÍÉÏÍø²é¿´×ÊÁÏ£¬¿´µ½ºÜ¶àÈËдµÄ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 ......