ʹÓÃĸ°æҳʱÄÚÈÝÒ³ÈçºÎʹÓÃcssºÍjavascript
ÓÉÓÚÍøÕ¾µÄÖ÷ҪƵµÀÒ³ºÍÁбíÒ³µÄÍ·²¿ºÍµ×²¿¶¼ÊÇÒ»ÑùµÄ£¬Èç¹û½«Ã¿¸öÒ³Ãæ·ÅÔÚµ¥¶ÀµÄÒ³ÃæÖУ¬µ±Í·²¿ºÍµ×²¿ÐèÒª¸ü¸Äʱά»¤Á¿Ì«´ó¡£ÓÚÊÇÏë°ÑÍ·²¿ºÍµ×²¿×ö³Éĸ°æÒ³£¬ÆµµÀÒ³ºÍÁбíÒ³µÄ¾ßÌåÄÚÈݷŵ½ÄÚÈÝÒ³ÖС£ÕâÑùµ±Í·ºÍµ×ÐèÒª¸Ä¶¯Ê±£¬Ö»ÒªÐÞ¸ÄÒ»ÏÂĸ°æÒ³¾Í¿ÉÒÔÁË¡£
ºÃ´¦ÓÐÁË£¬ÎÊÌâÒ²½Ó×ÅÀ´ÁË¡£ÔÀ´ÔÚƵµÀÒ³ºÍÁбíÒ³ÖÐÓÐÆä¸÷×ÔµÄcssÒýÈëºÍһЩjavascriptº¯Êý£¬µ±Ê¹ÓÃĸ°æҳʱ£¬·ÅÔÚÄÚÈÝÒ³ÖÐÕâЩcssÑùʽºÍjavascriptº¯ÊýÔõô´¦ÀíÄØ£¿ÒòΪ´ó¼ÒÖªµÀ£¬Ê¹ÓÃĸ°æÒ³µÄÄÚÈÝÒ³ÊDz»ÄÜ°üº¬<head></head>±ê¼ÇµÄ£¬¶øcssºÍjavascriptº¯ÊýµÄÉùÃ÷ÊÇÒª·Åµ½<head></head>ÖмäµÄ£¬ÕâЩcssÑùʽºÍjavascriptº¯ÊýÈçºÎ´¦ÀíÄØ£¿ÉÏÍø²éÁËһϣ¬´óÖÂÓÐÈýÖÖ½â¾ö·½°¸£º·½°¸Ò»£º°ÑËùÓеÄcssÑùʽºÍjavascriptº¯Êý·Åµ½Ä¸°æÒ³µÄ<head></head>ÖУ¬ÎÒ¾õµÃÕâÑù×öµÄ±×¶Ë¾ÍÊǵ¼ÖÂĸ°æÒ³µÄ<head></head>ÇøÌرðÓ·Ö×£¬Í¬Ê±Èç¹ûÔÀ´Á½¸öƵµÀÒ³Öаüº¬Í¬ÃûµÄcssÉùÃ÷»òjavascriptº¯Êý£¬µ«È´ÊDz»Í¬Ñùʽ»òÖ´Ðв»Í¬²Ù×÷£¬Ôõô°ìÄØ£¿ËùÒÔÕâµÚÒ»ÖÖ·½°¸ºÜ¿ì±»ÎÒ·ñ¶¨ÁË¡£·½°¸¶þÊÇÔÚÄÚÈÝÒ³µÄPageLoadʼþÖÐͨ¹ý´úÂëÀ´Ö¸¶¨±¾ÄÚÈÝÒ³µÄcssÎļþ¡£¾ßÌå´úÂëÈçÏ£º
´úÂëÈçÏÂ:
static public class ControlHelper
{
static public void AddStyleSheet(Page page, string cssPath)
{
HtmlLink link = new HtmlLink();
link.Href = cssPath;
link.Attributes["rel"] = "stylesheet";
link.Attributes["type"] = "text/css";
page.Header.Controls.Add(link);
}
}
ÕâÑù£¬ÔÚ¾ßÌåÒ³Ã棬ÎÒÃǾͿÉÒÔͨ¹ýÈçÏ´úÂëÌí¼Ó CSS ÒýÓãº
¸´ÖÆ´úÂë´úÂëÈçÏÂ:
protected void Page_Load(object sender, EventArgs e)
{
ControlHelper.AddStyleSheet(this.Page, "css/projectPage.css");
}
ÕâÖÖ½â¾ö·½°¸µÄºÃ´¦Ê±¿ÉÒÔÔÚ³ÌÐòÔËÐÐʱ¶¯Ì¬¸ü¸ÄËùÐèµÄcssÎļþ£¬µ«ÊǶÔjavascriptº¯Êý´¦ÀíÆðÀ´¸ÃÔõô×öÄØ£¿ÔÙ˵ÓбØÒª°Ñ±¾¸Ã¼ÓÔÚhtml´úÂëÖеÄcssºÍjavascriptͨ¹ýcs´úÂëÀ´¼ÓÈëÂð£¿Òò´Ë£¬ÕâÖÖ½â¾ö·½°¸Ò²ºÜ¿ì±»ÎÒ·ñ¶¨ÁË¡£Ê£ÏµĵÚÈýÖÖ½â¾ö·½°¸¾ÍÊÇÔÚĸ°æÒ³µÄ<head></head>ÖÐÌí¼ÓÒ»¸öÄÚÈݿؼþ£¬È»ºóÔÚÄÚÈÝÒ³ÖÐÔÚ¶ÔÓ¦µÄÄÚÈݿؼþÖÐдcssºÍjavascript´úÂë¡£ÌýÆðÀ´Õâ¸öÕâ¸ö½â¾ö·½°¸Ó¦¸ÃÊÇ×
Ïà¹ØÎĵµ£º
Èç¹ûÄãÊÇÍøվǰ¶Ë¿ª·¢ÈËÔ±£¬ÄÇô¶ÔÄãÀ´Ëµ£¬Ò²Ðí×öÒ»¸öƯÁÁµ¼º½²Ëµ¥»áºÜµÃÐÄÓ¦ÊÖ¡£±¾ÎÄҪΪ´ó¼Ò×ܽá¸÷ÖÖµ¼º½²Ëµ¥µÄ×ÊÔ´£¬ÒÔ±ãÈôó¼ÒµÄÍøվǰ¶Ë¿ª·¢µÄ¹¤×÷¸ü
·½±ã¸ü¿ìËÙ£¬Ö»ÒªÑ¡ÔñÏֳɵÄÀý×ӾͿÉÒÔÓ¦ÓÃÓÚ×Ô¼ºµÄÍøÕ¾ÁË¡£±¾ÎÄÊÕ¼¯µÄÕâЩ×ÊÔ´£¬´Ó·Ç³£¼òµ¥µÄHTMLºÍCSSµ¼º½²Ëµ¥£¬µ½·Ç³£¸´ÔӺ͸߼¶µÄ
JQuer ......
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<TITLE>ÎÞˢб任Ñùʽ±í</TITLE>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" /& ......
1. ¼ì²éHTMLÔªËØÊÇ·ñÓÐƴд´íÎó¡¢ÊÇ·ñÍü¼Ç½áÊø±ê¼Ç
¼´Ê¹ÊÇÀÏÊÖÒ²¾³£»áŪ´ídivµÄǶÌ×¹Øϵ¡£¿ÉÒÔÓÃdreamweaverµÄÑéÖ¤¹¦Äܼì²éÒ»ÏÂÓÐÎÞ´íÎó¡£
2. ¼ì²éCSSÊÇ·ñÕýÈ·
¼ì²éÒ»ÏÂÓÐÎÞƴд´íÎó¡¢ÊÇ·ñÍü¼Ç½áβµÄ } µÈ¡£¿ÉÒÔÀûÓÃCleanCSSÀ´¼ì²é CSSµÄƴд´íÎó¡£CleanCSS±¾ÊÇΪCSS¼õ·ÊµÄ¹¤¾ß£¬µ«Ò²Äܼì²é³öƴд´íÎó¡£
3. È·¶¨´íÎó·¢ ......
cssÔ²½Çbox(°Ù¶ÈÖªµÀÍÚ³ö) 1.css .zhidao_box {
position: relative;
width: 100%;
}
.zhidao_box .rg_1, .zhidao_box .rg_2, .zhidao_box .rg_3 {
height: 1px;
font-size: 0px;
ov ......
<!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"> &nb ......