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

ͨ¹ýʹҳÃ涯̬¼ÓÔز»Í¬CSSʵÏÖ¶à½çÃæ

 Í¨¹ýʹҳÃ涯̬¼ÓÔز»Í¬CSSʵÏÖ¶à½çÃæ
·½·¨Ò»:
<%@page language="C#"%>
<%@import namespace="System.Data"%>
<script language="c#" runat="server">
public void page_load(Object obj,EventArgs e)
{
//´´½¨·þÎñÆ÷¶Ë¿Ø¼þ.
//Ö¸¶¨µÄ±ê¼Ç"LINK"³õʼ»¯´ËÀàµÄÐÂʵÀý.
HtmlGenericControl objLink=new HtmlGenericControl("LINK");
objLink.ID=ID;
objLink.Attributes["rel"]="stylesheet";
objLink.Attributes["type"]="text/css";
objLink.Attributes["href"]="portal.css";
//´Ë¿Ø¼þ²»²úÉúÈκοɼûÊä³ö,½ö×÷ΪÆäËû¿Ø¼þµÄÈÝÆ÷,¿ÉÔÚÆäÖÐÌí¼Ó,²åÈë»òÒƳý¿Ø¼þ.
MyCSS.Controls.Add(objLink);
}
</script>
<html>
<head>
<title>c#</title>
<asp:placeholder id="MyCSS" runat="server"></asp:placeholder>
</head>
<body bgColor="#ffcc66" style="FONT:9pt">
<form runat="server">
</form>
</body>
</html>
ͨ¹ý¶¯Ì¬ÉèÖÃÒ³ÃæËùÓÐͬÀàÐͿؼþµÄÑùʽÀ´¸Ã±ä½çÃæ:
·½·¨¶þ:
¿ÉÒÔͨ¹ý¸Ä±äWEB¿Ø¼þµÄCssClassÊôÐÔ,¿É·½±ãµØÉèÖúÍÐ޸ĿؼþµÄÑùʽ¡£
µ«ÔÚʵ¼Ê¿ª·¢¹ý³ÌÖÐ,Ò»¸ö¸öµØÉèÖÿؼþµÄCssClassÊôÐÔ,·Ç³£·±Ëö,ËùÒÔ´Ë˼·ӦÓò»¹ã.
µ«ÏÂÃæµÄ´úÂë¶ÎÑÝʾÁËÒ»´ÎÐԸıäÒ³ÃæËùÓÐͬÀàÐͿؼþµÄÑùʽµÄ·½·¨,¿ÉÒÔʵÏÖ¼òµ¥µÄSKINµÈ¹¦ÄÜ¡£
´úÂëÈçÏÂ:
public void page_load(Object obj,EventArgs e)
{
if(!Page.IsPostBack){
//ΪҳÃæµÄËùÓпؼþÉèÖÃÑùʽ.
SetCSS(Page.Controls);
}
}
private void SetCSS(System.Web.UI.ControlCollection vControls)
{
for(int i=0;i<vControls.Count;i++)
{
System.Web.UI.Control vControl=vControls[i];
//µÃµ½¿Ø¼þµÄÀàÐÍ
//¿ÉÔö¼Ó¿Ø¼þÀàÐͼ°ÏàÓ¦´¦Àí·½·¨
string PType=vControl.GetType().Name;
switch (PType)
{
case "TextBox":
TextBox_CSS ((TextBox) vControl);
break;
case "Button":
//Button_CSS ((Button) vControl);
break;
case "DataGrid":
//DataGrid_CSS ((DataGrid) vControl);
break;
}
if(vControl.Controls.Count>0)
SetCSS(vControl.Controls);
}
}
private void TextBox_CSS(TextBox tb){
tb.CssClass="TextBox_show";
}
<form runat="server">


Ïà¹ØÎĵµ£º

css¼æÈÝÓë²î±ð¡¡IE6,IE7,IE8,FireFox,Opera,Safari

¡¾Web¡¿css¼æÈÝÓë²î±ð¡¡IE6,IE7,IE8,FireFox,Opera,Safari
2010-01-16 18:50
¡¾Web¡¿css¼æÈÝÓë²î±ð¡¡IE6,IE7,IE8,FireFox,Opera,Safari
2010-01-13 11:07
ÍâÖÃ
.main{ float:left;#float:none;_float:none;
html*.main{ float:left;#float:none;_float:none; }
*+html .main{ float:left;#float:none;_float:none; } ......

CSS¼æÈÝIE6¡¢IE7¡¢»ðºü£¨Firefox£©¼¼Çɼ¯ºÏ


 CSS ¶Ôä¯ÀÀÆ÷µÄ¼æÈÝÐÔÓÐʱÈÃÈ˺ÜÍ·ÌÛ£¬»òÐíµ±ÄãÁ˽⵱Öеļ¼ÇɸúÔ­Àí£¬¾Í»á¾õµÃÒ²²»ÊÇÄÑÊ£¬´ÓÍøÉÏÊÕ¼¯ÁËIE7,6ÓëFireofxµÄ¼æÈÝÐÔ´¦Àí·½·¨²¢ÕûÀíÁË Ò»Ï¡£¶ÔÓÚweb2.0µÄ¹ý¶È£¬Ç뾡Á¿ÓÃxhtml¸ñʽд´úÂ룬¶øÇÒDOCTYPE Ó°Ïì CSS ´¦Àí£¬×÷ΪW3CµÄ±ê×¼£¬Ò»¶¨Òª¼Ó DOCTYPEÉùÃ÷¡£ 
 
CSS¼¼ÇÉ 
 
1.d ......

IEºÍFirefoxÔÚJSºÍCSS·½ÃæµÄ¼æÈÝÐÔ

1.document.formName.item("itemName") ÎÊÌâ
˵Ã÷:IEÏÂ,¿ÉÒÔʹÓÃdocument.formName.item("itemName")»òdocument.formName.elements["elementName"];
FirefoxÏÂ,Ö»ÄÜʹÓÃdocument.formName.elements["elementName"].
½â¾ö·½·¨:ͳһʹÓÃdocument.formName.elements["elementName"].
2.¼¯ºÏÀà¶ÔÏóÎÊÌâ
˵Ã÷:
IEÏÂ,¿ÉÒÔ ......

CSSµÄÊ®°Ë°ã¼¼ÇÉ

×î½ü,¾­³£ÓÐÅóÓÑÎÊÎÒһЩ¹¤×÷ÖÐÓöµ½µÄCSSÎÊÌâ¡£ËûÃÇ×ÜÊDz»ÄܺܺõĿØÖÆCSS£¬Ó°ÏìCSSµÄЧÂÊ·¢»Ó¡£ÎÒÀ´·ÖÎö×ܽáһϴíÎóËùÔÚ£¬°ïÖú´ó¼Ò¸ü¼ÓÈÝÒ×ʹÓÃCSS¡£
±¾ÎÄ×ܽáÁËÎÒ¿ªÊ¼Ê¹ÓÃCSS²¼¾Ö·½·¨ÒÔÀ´ËùÓеļ¼ÇɺͼæÈÝ·½°¸£¬ÎÒÔ¸Òâ°ÑÕâЩÓëÄã·ÖÏí£¬ÎÒ»áÖصã½âÊÍһЩÐÂÊÖÈÝÒ×·¸µÄ´íÎó(°üÀ¨ÎÒ×Ô¼ºÒ²·¸¹ýµÄ)£¬Èç¹ûÄãÒѾ­ÊÇCSS¸ßÊÖ£¬ÕâÐ ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØͼ | ¸ÓICP±¸09004571ºÅ