當前位置:才華齋>設計>網頁設計>

asp.net 動態引用樣式表程式碼示範

網頁設計 閱讀(1.26W)

1. 新增CSS樣式:

asp.net 動態引用樣式表程式碼示範

Style style = new Style();

Color = ;

Color = tGray;

teStyleRule(style, null, "body");

2. 連結外部的CSS樣式表:

HtmlLink link = new HtmlLink();

("type", "text/css");

("rel", "stylesheet");

("href", "~/");

(link);

方法3 public string m_StyleSrc = y; //公共變數 ,樣式檔案路徑

private void Page_Load(object sender, tArgs e) {

m_StyleSrc = "../"; //頁面載入時賦值 }

}

方法4 下面這個方法沒試過,不知是否能用

protected void Page_Onload(object sender, EventArgs e) {

eSheetTheme = "../css/";

}

方法5 頁面:

後臺

= "css檔案路徑";