Ò׽ؽØͼÈí¼þ¡¢µ¥Îļþ¡¢Ãâ°²×°¡¢´¿ÂÌÉ«¡¢½ö160KB

CSSÒ³Ãæ²»¼æÈÝÎÊÌâ

¹ØÓÚCSS¶Ô¸÷¸öä¯ÀÀÆ÷¼æÈÝÒѾ­ÊÇÀÏÉú³£Ì¸µÄÎÊÌâÁË, ÍøÂçÉϵĽ̳̱éµØ¶¼ÊÇ.ÒÔÏÂÄÚÈÝûÓÐÌ«¶àÐÂÓ±, ´¿Êô¸öÈË×ܽá, Ï£ÍûÄܶԳõѧÕßÓÐÒ»¶¨µÄ°ïÖú.
Ò»¡¢CSS HACK
ÒÔÏÂÁ½ÖÖ·½·¨¼¸ºõÄܽâ¾öÏÖ½ñËùÓÐHACK.
1, !important
Ëæ×ÅIE7¶Ô!importantµÄÖ§³Ö, !important ·½·¨ÏÖÔÚÖ»Õë¶ÔIE6µÄHACK.(×¢Òâд·¨.¼ÇµÃ¸ÃÉùÃ÷λÖÃÐèÒªÌáÇ°.)
<style>
#wrapper
{
width: 100px!important; /* IE7+FF */
width: 80px; /* IE6 */
}
</style>
2, IE6/IE77¶ÔFireFox
*+html Óë *html ÊÇIEÌØÓеıêÇ©, firefox Ôݲ»Ö§³Ö.¶ø*+html ÓÖΪ IE7ÌØÓбêÇ©.
<style>
#wrapper
{
#wrapper { width: 120px; } /* FireFox */
*html #wrapper { width: 80px;} /* ie6 fixed */
*+html #wrapper { width: 60px;} /* ie7 fixed, ×¢Òâ˳Ðò */
}
</style>
×¢Òâ:
*+html ¶ÔIE7µÄHACK ±ØÐë±£Ö¤HTML¶¥²¿ÓÐÈçÏÂÉùÃ÷£º
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
¶þ¡¢ÍòÄÜ float ±ÕºÏ
¹ØÓÚ clear float µÄÔ­Àí¿É²Î¼û [How To Clear Floats Without Structural Markup]
½«ÒÔÏ´úÂë¼ÓÈëGlobal CSS ÖÐ,¸øÐèÒª±ÕºÏµÄdiv¼ÓÉÏ class="clearfix" ¼´¿É,ÂÅÊÔ²»Ë¬.
<style>
/* Clear Fix */
.clearfix:after
{
content:".";
display:block;
height:0;
clear:both;
visibility:hidden;
}
.clearfix
{
display:inline-block;
}
/* Hide from IE Mac */
.clearfix {display:block;}
/* End hide from IE Mac */
/* end of clearfix */
</style>
Èý¡¢ÆäËû¼æÈݼ¼ÇÉ
1, FFϸø div ÉèÖà padding ºó»áµ¼Ö width ºÍ height Ôö¼Ó, µ«IE²»»á.(¿ÉÓÃ!important½â¾ö)
2, ¾ÓÖÐÎÊÌâ.
1).´¹Ö±¾ÓÖÐ.½« line-height ÉèÖÃΪ µ±Ç° div ÏàͬµÄ¸ß¶È, ÔÙͨ¹ý vertical-align: middle.( ×¢ÒâÄÚÈݲ»Òª»»ÐÐ.)
2).ˮƽ¾ÓÖÐ. margin: 0 auto;(µ±È»²»ÊÇÍòÄÜ)
3, ÈôÐè¸ø a ±êÇ©ÄÚÄÚÈݼÓÉÏ Ñùʽ, ÐèÒªÉèÖà display: block;(³£¼ûÓÚµ¼º½±êÇ©)
4, FF ºÍ IE ¶Ô BOX Àí½âµÄ²îÒìµ¼ÖÂÏà²î 2px µÄ»¹ÓÐÉèΪ floatµÄdivÔÚieÏ margin¼Ó±¶µÈÎÊÌâ.
5, ul ±êÇ©ÔÚ FF ÏÂÃæĬÈÏÓÐ list-style ºÍ padding . ×îºÃÊÂÏÈÉùÃ÷, ÒÔ±ÜÃâ²»±ØÒªµÄÂé·³. (³£¼ûÓÚµ¼º½±êÇ©ºÍÄÚÈÝÁбí)
6, ×÷ΪÍⲿ wrapper µÄ div ²»Òª¶¨ËÀ¸ß¶È, ×îºÃ»¹¼ÓÉÏ overflow: hidden.ÒÔ´ïµ½¸ß¶È×ÔÊÊÓ¦.
7, ¹ØÓÚÊÖÐιâ±ê. cursor: po


Ïà¹ØÎĵµ£º

´«ÖDz¥¿Íѧϰ×ܽá CSS²ãµþÑùʽ±í

CSS(Cascading Style Sheets)²ãµþÑùʽ±í×÷ÓÃÊǽ«ÍøÒ³ÄÚÈݺÍÏÔʾÑùʽ½øÐзÖÀ룬Ìá¸ßÁËÏÔʾ¹¦ÄÜ¡£
CSS´úÂë¸ñʽ£º
       Ñ¡ÔñÆ÷Ãû³Æ { ÊôÐÔÃû£ºÊôÐÔÖµ£»ÊôÐÔÃû£ºÊôÐÔÖµ£»……}
Ñ¡ÔñÆ÷£¨¶Ô²»Í¬µÄHTML±êÇ©½øÐпØÖÆ£¬²¢¸³Óè¸÷ÖÖÑùʽÉùÃ÷£¬¼´¿ÉʵÏÖ¸÷ÖÖЧ¹û£©£º
  ±êÇ©Ñ ......

cssαÀàhover ie6bug£¬½Ò¿ªIE6ÏÂhover²»ÏÔʾԭÒò

:hoverÊÇÎÒÃÇÔÚCSSÉè¼ÆÖÐ×î³£ÔËÓõÄαÀàÖ®Ò»£¬Ðí¶àѤÀöЧ¹ûµÄʵÏÖÀë²»¿ªÎ±Àà:hover£¬±ÈÈçÎÒÃdz£¼ûµÄ´¿CSS²Ëµ¥¡¢Ïà²áЧ¹ûµÈµÈ¡£
»òÐíÓÃÁËÕâô¾ÃµÄαÀà:hover£¬»¹Óв¿·ÖÅóÓÑ»¹²»ÍêÈ«Á˽âhoverµÄ¹æÔò£º
ÔÚCSS1ÖдËαÀà½ö¿ÉÓÃÓÚa¶ÔÏó¡£ÇÒ¶ÔÓÚÎÞhrefÊôÐÔ£¨ÌØÐÔ£©µÄa¶ÔÏ󣬴ËαÀ಻·¢Éú×÷Óá£
ÔÚCSS2ÖдËαÀà¿ÉÒÔÓ¦ÓÃÓÚÈκζÔÏ ......

¶ÔDIV+CSSµÄÒ»µãÐĵÃÌå»á£¬ÈÃÄ㾡¿ìѧ»á²¼¾ÖÉèÖÃ

Çë¿´ÏÂÃæÒ»¶Î´úÂ룺
<HTML>
<HEAD>
<style>
#login {font-size:14px;color:blue;}//¶¨ÒåÁËÒ»¸öID
.left{FONT-SIZE=12PX;COLOR=RED;TEXT-ALIGN=CENTER;}//¶¨ÒåÁËÒ»¸öÀà
</style>
<TITLE>Öйú</TITLE>
<BODY>
<DIV STYLE="FONT-SIZE=12PX;COLOR=RED;TEXT-ALIGN=RIGHT; ......

ÓÃcss¸Ä±äÊó±êÏÔʾ

Ò»°ã¶øÑÔ£¬Êó±êÒÔбÏòÉϵļýÍ·ÏÔʾ£¬ÒƵ½Îı¾ÉÏʱ±äΪÓÐÍ·µÄÊúÏߣ¬ÒƵ½³¬¼¶Á´½ÓÉϱäΪÊÖÐÍ¡£µ«ÓÃcss¿É¿ØÖÆÊó±êµÄÏÔʾЧ¹û£¬Èç¿ÉʹÊó±êÒƵ½ÆÕͨÎı¾ÉÏÒ²ÏÔʾ³ÉÊÖÐÍ¡£ ÓÃcss¿ØÖƵÄÓï·¨ÈçÏÂ: span style="cursor:*"Îı¾»òÆäËüÒ³ÃæÔªËØ/span °Ñ * »»³ÉÈçÏÂ15¸öЧ¹ûµÄÒ»ÖÖ£º
¡¡¡¡ Ò»°ã¶øÑÔ£¬Êó±êÒÔбÏòÉϵļýÍ·ÏÔʾ£¬ÒƵ½Îı¾ÉÏ ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØͼ | ¸ÓICP±¸09004571ºÅ