div+cssÖÆ×÷µÄµ¯³ö²Ëµ¥(±ê×¼ÇÒÎÞjs)
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Èý¼¶dropdownµ¯³ö²Ëµ¥</title>
<style type="text/css">
/* common styling */
.menu {font-family: arial, sans-serif; width:750px; position:relative; margin:0; font-size:11px; margin:50px 0;}
.menu ul li a, .menu ul li a:visited {display:block; text-decoration:none; color:#000;width:104px; height:20px; text-align:center; color:#fff; border:1px solid #fff; background:#710069; line-height:20px; font-size:11px; overflow:hidden;}
.menu ul {padding:0; margin:0;list-style-type: none; }
.menu ul li {float:left; margin-right:1px; position:relative;}
.menu ul li ul {display: none;}
/* specific to non IE browsers */
.menu ul li:hover a {color:#fff; background:#36f;}
.menu ul li:hover ul {display:block; position:absolute; top:21px; left:0; width:105px;}
.menu ul li:hover ul li a.hide {background:#6a3; color:#fff;}
.menu ul li:hover ul li:hover a.hide {background:#6fc; color:#000;}
.menu ul li:hover ul li ul {display: none;}
.menu ul li:hover ul li a {display:block; background:#ddd; color:#000;}
.menu ul li:hover ul li a:hover {background:#6fc; color:#000;}
.menu ul li:hover ul li:hover ul {display:block; position:absolute; left:105px; top:0;}
.menu ul li:hover ul li:hover ul.left {left:-105px;}
</style>
<!--[if lte IE 6]>
<style type="text/css">
.menu ul li a.hide, .menu ul li a:visited.hide {display:none;}
.menu ul li a:hover ul li a.hide {display:none;}
.menu ul li a:hover {color:#fff; background:#36f;}
.menu ul li a:hover ul {display:block; position:absolute; top:21px; left:0; width:105px;}
.menu ul li a:hover ul li a.sub {background:#6a3; color:#fff;}
.menu ul li a:hover ul li a {display:block; background:#ddd; color:#000;}
.menu ul li a:hover
Ïà¹ØÎĵµ£º
Èç¹ûÔÚÓÃCSSÉè¼Æ²¼¾ÖʱÓöµ½BUG£¬ÇëÈÏÕæÔĶÁÒÔÏÂÄÚÈÝ£¬·Ç³£ÈÝÒ×¼ÇÒäµÄ£¬²»ÖªµÀÄÄλ¸ßÈË°ÑCSS BUG±à³ÉÁË˳¿ÚÁïÁË£¡¿´¿´ºÃ²»ºÃ¼ÇסÄØ£¿ Ò»¡¢IE±ß¿òÈôÏÔÈôÎÞ£¬Ðë×¢Ò⣬¶¨ÊǸ߶ÈÉèÖÃÒÑÍü¼Ç£» ¶þ¡¢¸¡¶¯²úÉúÓÐÔµ¹Ê£¬ÈôÒª¸¸²ã°üº¬×¡£¬½ô¸ú¸¡¶¯ÒªÇå³ý£¬
Èç¹ûÔÚÓÃCSSÉè¼Æ²¼¾ÖʱÓöµ½BUG£¬ÇëÈÏÕæÔĶÁÒÔÏÂÄÚÈÝ£¬·Ç³£ÈÝÒ×¼ÇÒäµÄ£¬²»ÖªµÀÄ ......
³£ÓõÄÍøÕ¾ÃüÃû ÊÕ²Ø
1.CSS ID µÄÃüÃû
ҳͷ£ºheader
µÇ¼Ìõ£ºloginbar
±êÖ¾£ºlogo
²àÀ¸£ºsidebar
¹ã¸æ£ºbanner
µ¼º½£ºnav
×Óµ¼º½£ºsubnav
²Ëµ¥£ºmenu
×Ӳ˵¥£ºsubmenu
ËÑË÷£ºsearch
¹ö¶¯£ºscroll
Ò³ÃæÖ÷Ì壺main
ÄÚÈÝ£ºcontent
±êÇ©Ò³£ºtab
ÎÄÕÂÁÐ±í£ºlist
ÌáʾÐÅÏ¢£ºmsg
С¼¼ÇÉ£ºtips
À¸Ä¿±êÌâ ......
http://www.cnblogs.com/rubylouvre/archive/2009/08/10/1542476.html
˵ÊÇʵÏÖ¼æÈÝ£¬ÆäʵҲֻ²»¹ýΪÁËÕÕ¹ËIE6ÓëIE7£¬Æäʵ²»Ö§³Ö±ê×¼µÄ¶ÔÊÖÔç¾ÍÑÌ·É»ÒÃ𣬶øÏñfirefox£¬Opera£¬SafariµÈ¸üл»´úÌ«¿ì£¬¾ÍËãÓÐÎÊÌâºÜ¿ì¾Í±»¹Ù·½´¦Àí¡£Òò´ËÕâƪ²©ÎÄ´ó¼Ò×îºÃÔÚIE6ÖÐä¯ÀÀ£¬ÀïÃæ¿ÉÔËÐеÄÀý×Ó¶¼ÊÇΪIE6×¼±¸µÄ¡£
Ñ¡ÔñÆ÷
ͨÅä·û * ......
Ò»ÄêÀïÓöµ½µÄcssÎÊÌâ×ܽáһϣº
µ½ÏÖÔÚ·¢ÏÖÓÃhackÔ½¶àÖ¤Ã÷ÄãµÄˮƽԽ²î£¬Ä¿Ç°Ð´µÄ´úÂ뼸ºõûÓÐÓõ½ÕâЩ½â¾ö·½·¨ÁË¡£µ«ÊÇ»°Ëµ»ØÀ´Ö»ÓÐÓöµ½ÎÊÌâ²¢ÇÒ½â¾ö²ÅÄÜ×îÖÕ´ïµ½Ô¤·À¡£Ö±µ½ËùÓеĶ¼Óöµ½ÁËÄãÒ²¾ÍÊǸßÊÖÁË£¡
Ó¦ÓÃ×î¶àµÄ±¾È˸оõ¾ÍÊÇ£ºheight:1%;overflow:hidden;//½â¾öfloatµÈÎÊÌâ
1¡¢¸ß¶È×ÔÊÊÓ¦ÎÊÌ⣺
ÍêÃÀ½â¾ö ......
´ÓÍøÉÏÊÕ¼¯ÁËIE7,6ÓëFireofxµÄ¼æÈÝÐÔ´¦Àí·½·¨²¢ÕûÀíÁËÒ»ÏÂ.¶ÔÓÚweb2.0µÄ¹ý¶È,Ç뾡Á¿ÓÃxhtml¸ñʽд´úÂë,¶øÇÒDOCTYPE Ó°Ïì CSS ´¦Àí,×÷ΪW3CµÄ±ê×¼,Ò»¶¨Òª¼Ó DOCTYPEÉùÃû.
CSS¼¼ÇÉ
1.divµÄ´¹Ö±¾ÓÖÐÎÊÌâ vertical-align:middle; ½«ÐоàÔö¼Óµ½ºÍÕû¸öDIVÒ»Ñù¸ß line-height:200px; È»ºó²åÈëÎÄ×Ö£¬¾Í´¹Ö±¾ÓÖÐÁË¡£È±µãÊÇÒª¿ØÖÆÄÚ ......