HtmlHead.StyleSheet 屬性
定義
重要
部分資訊涉及發行前產品,在發行之前可能會有大幅修改。 Microsoft 對此處提供的資訊,不做任何明確或隱含的瑕疵擔保。
取得 IStyleSheet 執行個體,表示 HtmlHead 控制項中的樣式規則。
public:
property System::Web::UI::IStyleSheet ^ StyleSheet { System::Web::UI::IStyleSheet ^ get(); };
public System.Web.UI.IStyleSheet StyleSheet { get; }
member this.StyleSheet : System.Web.UI.IStyleSheet
Public ReadOnly Property StyleSheet As IStyleSheet
屬性值
物件,表示 HtmlHead 控制項中的樣式規則。
範例
下列範例示範如何以程式設計方式新增 HTML body
元素的內嵌樣式規則。 這個範例是提供給 類別之較大範例的 HtmlHead 一部分。
// Add the style rule named bodyStyle to the header
// of the current page. The rule is for the body HTML element.
Page.Header.StyleSheet.CreateStyleRule(bodyStyle, null, "body");
' Add the style rule named bodyStyle to the header
' of the current page. The rule is for the body HTML element.
Page.Header.StyleSheet.CreateStyleRule(bodyStyle, Nothing, "body")
備註
屬性會 StyleSheet 傳回 , IStyleSheet 表示 控制項中的 HtmlHead 內嵌樣式規則。
注意
不支援在非同步回傳期間以程式設計方式新增樣式或樣式規則。 當您將 AJAX 功能新增至 ASP.NET 網頁時,非同步回傳會更新頁面的區域,而不會更新整個頁面。 如需詳細資訊,請參閱Microsoft Ajax 概觀。
適用於
另請參閱
意見反應
https://aka.ms/ContentUserFeedback。
即將登場:在 2024 年,我們將逐步淘汰 GitHub 問題作為內容的意見反應機制,並將它取代為新的意見反應系統。 如需詳細資訊,請參閱:提交並檢視相關的意見反應