Pages Html

NuGet packageOwin.Framework.Pages.Html
GitHub sourceOwinFramework.Pages.Html

Home |  Readme

[DeployCss] attribute | The OWIN Framework Pages

The [DeployCss] Attribute

You can attach this attribute to any visual element and it will cause CSS to be included in any page containing that element. Where the CSS will be rendered is defined by the [DeployedAs] attribute.

This attribute is useful for very small amounts of CSS that is very specific to this element. It is recommended that larger amounts of CSS should be contained in a .less file instead.

Note that even if this element is rendered many times on the pages, the CSS rules will only be rendered once.

Example Usage

[Container("ul", "{ns}_menu")]
[ChildContainer("li", "{ns}_menu-item")]
[DeployCss("ul.{ns}_menu", "font-size: 14px;")]
[DeployCss("li.{ns}_menu-item", "font-size: 12px;")]
public class MenuRegion

The [DeployCss()] attribute has the following properties you can set.


This property can contain any valid CSS selector for the style. If you are using package namespaces (recommended) then you can have the appropriate namespace prefix added to class names by putting the spacial {ns}_ marker directly in front of CSS class names.


Defines the style to apply to elements that match the selector.


CSS rules are rendered in order of lowest to highest value for the Order property. This property defaults to zero for [DeployCss()] attributes that do not specify the value to use.