htmlÂÒÂëÔõô½â¾ö
htmlÂÒÂëÊÇÓÉ×Ö·û±àÂ벻׼ȷÔì³ÉµÄ¡£½â¾öÒªÁìÓУº1. ¼ì²é×Ö·û±àÂ룻2. ת»»×Ö·û±àÂ룻3. ʹÓÃ×Ö·ûʵÌ壻4. ʹÓÃcdn£»5. ʹÓÃunicode bom£»6. ʹÓÃ×Ö·ûתÒå¡£
HTMLÂÒÂëµÄ½â¾öÒªÁì
HTMLÂÒÂëÊÇÖ¸ÔÚÍøÒ³ÖÐÏÔʾµÄ×Ö·ûÓëÏÖʵµÄ×Ö·û·×ÆçÖµÄÇéÐΡ£Õâͨ³£ÊÇÓÉ×Ö·û±àÂ벻׼ȷµ¼Öµġ£
½â¾öÒªÁ죺
1. ¼ì²é×Ö·û±àÂë
Á¬Ã¦Ñ§Ï°¡°Ç°¶ËÃâ·ÑѧϰÌõ¼Ç£¨ÉîÈ룩¡±£»
È·±£HTMLÎĵµµÄ×Ö·û±àÂëÓëËùʹÓõÄ×Ö·û¼¯ÏàÆ¥Åä¡£³£¼ûµÄ×Ö·û±àÂë°üÀ¨UTF-8¡¢UTF-16ºÍISO-8859-1¡£Äú¿ÉÒÔÔÚHTMLÎĵµµÄ
±êÇ©Öмì²é×Ö·û±àÂ룺
<meta charset="UTF-8">
µÇ¼ºó¸´ÖÆ
2. ת»»×Ö·û±àÂë
ÈôÊÇ×Ö·û±àÂ벻׼ȷ£¬¿ÉÒÔʹÓÃÎı¾±à¼Æ÷»òÔÚÏß¹¤¾ß½«Îļþת»»Îª×¼È·µÄ×Ö·û±àÂë¡£ÀýÈ磬Äú¿ÉÒÔʹÓÃNotepad++»òTextWranglerµÈÎı¾±à¼Æ÷£¬²¢´Ó¡°±àÂ롱²Ëµ¥ÖÐÑ¡ÔñËùÐèµÄ×Ö·û±àÂë¡£
3. ʹÓÃ׼ȷµÄ×Ö·ûʵÌå
¹ØÓÚһЩÌØÊâ×Ö·û£¬¿ÉÒÔʹÓÃ×Ö·ûʵÌåÀ´ÌåÏÖËüÃÇ¡£×Ö·ûʵÌåÒÔ¡°&¡±¿ªÍ·£¬ÒÔ¡°;¡±×îºó¡£ÀýÈ磬ҪÏÔʾ°æȨ·ûºÅ£¬Äú¿ÉÒÔʹÓÃ×Ö·ûʵÌå¡°?¡±¡£
4. ʹÓÃCDN
ÄÚÈÝ·Ö·¢ÍøÂ磨CDN£©¿ÉÒÔͨ¹ý»º´æ¾²Ì¬Îļþ£¬°üÀ¨HTMLÎĵµ£¬À´×ÊÖú½â¾ö×Ö·û±àÂëÎÊÌâ¡£CDN»á½«ÕâЩÎļþ´æ´¢ÔÚ¶ą̀ЧÀÍÆ÷ÉÏ£¬²¢ÇÒ¿ÉÒÔ×Ô¶¯È·¶¨²¢Ê¹ÓÃ׼ȷµÄ×Ö·û±àÂë¡£
5. ʹÓÃUnicode BOM
Unicode×Ö½Ú˳Ðò±ê¼Ç£¨BOM£©ÊÇÒ»¸öÌØÊâ×Ö·ûÐòÁУ¬ÓÃÓÚָʾÎļþµÄ×Ö·û±àÂë¡£ÔÚUTF-8Îļþ¿ªÍ·µÄ¼ÓÈëBOM¿ÉÒÔ×ÊÖú½â¾ö±àÂëÎÊÌâ¡£Äú¿ÉÒÔʹÓÃÎı¾±à¼Æ÷»òÔÚÏß¹¤¾ßÔÚUTF-8Îļþ¿ªÍ·²åÈëBOM¡£
6. ʹÓÃ×Ö·ûתÒå
¹ØÓÚһЩ²»³£¼ûµÄ×Ö·û£¬¿ÉÒÔʹÓÃ×Ö·ûתÒåÀ´ÌåÏÖËüÃÇ¡£×Ö·ûתÒåÒÔ¡°¡±¿ªÍ·£¬ÒÔ¡°;¡±×îºó£¬ºóÃæËæ×Å×Ö·ûµÄÊ®½øÖƱàÂë¡£ÀýÈ磬ҪÏÔʾһ¸ö·´Ð±¸Ü£¬¿ÉÒÔʹÓÃ×Ö·ûתÒå¡°\¡±¡£
ÒÔÉϾÍÊÇhtmlÂÒÂëÔõô½â¾öµÄÏêϸÄÚÈÝ£¬¸ü¶àÇë¹Ø×¢±¾ÍøÄÚÆäËüÏà¹ØÎÄÕ£¡