Partager via


CssLink class

Inserts a LINK element into the resulting HTML page and applies an external style sheet(s) defined by CssRegistration.

Inheritance hierarchy

System.Object
  System.Web.UI.Control
    Microsoft.SharePoint.WebControls.SPControl
      Microsoft.SharePoint.WebControls.CssLink

Namespace:  Microsoft.SharePoint.WebControls
Assembly:  Microsoft.SharePoint (in Microsoft.SharePoint.dll)

Syntax

'Declaration
<AspNetHostingPermissionAttribute(SecurityAction.LinkDemand, Level := AspNetHostingPermissionLevel.Minimal)> _
<AspNetHostingPermissionAttribute(SecurityAction.InheritanceDemand, Level := AspNetHostingPermissionLevel.Minimal)> _
Public Class CssLink _
    Inherits SPControl
'Usage
Dim instance As CssLink
[AspNetHostingPermissionAttribute(SecurityAction.LinkDemand, Level = AspNetHostingPermissionLevel.Minimal)]
[AspNetHostingPermissionAttribute(SecurityAction.InheritanceDemand, Level = AspNetHostingPermissionLevel.Minimal)]
public class CssLink : SPControl

Remarks

The CssLink server control resides on the master page while CssRegistration controls may be placed on a master page, page layout, or content page.

When the page is assembled, all of the style sheets are rendered by the CssLink control. If the styles that you define in your .css file are also in Corev4.css or the theme they will be overwritten (typical .css behavior).

Warning

Changes made to Corev4.css may be lost when Microsoft SharePoint Foundation is updated, such as through installation of service packs or patches. An alternate .css file can be specified in the ONET.XML file of a site definition by using the AlternateCSS attribute of the Project element.

If the UIVersion property of the Web page is set to 3, core.css will be rendered. If it is set to 4, corev4.css will be rendered.

This is an important distinction throughout the page.

Every reference to corev4.css on this page should be replaced with core.css/corev4.css.

Thread safety

Any public static (Shared in Visual Basic) members of this type are thread safe. Any instance members are not guaranteed to be thread safe.

See also

Reference

CssLink members

Microsoft.SharePoint.WebControls namespace