GH_CssStyle

References
Represents a single CSS style, consisting of a selector and a collection of properties.

Constructors

GH_CssStyle

#
public GH_CssStyle()
Create a new blank CSS style.

GH_CssStyle

#
public GH_CssStyle(string selector, GH_CssProperty property)
Create a new CSS style.
selector (string)Style selector.
property (GH_CssProperty)Style property.

GH_CssStyle

#
public GH_CssStyle(string selector, IEnumerable<GH_CssProperty> properties)
Create a new CSS style.
selector (string)Style selector.
properties (IEnumerable<GH_CssProperty>)Style properties.

GH_CssStyle

#
public GH_CssStyle(string selector)
Create a new CSS style.
selector (string)Style selector

Properties

Comments

#
public ReadOnlyCollection<string> Comments { get; }
Gets all the comments associated with this style.

IsClassSelector

#
public bool IsClassSelector { get; }
Gets a value indicating whether this style defines a CSS class.

IsIdSelector

#
public bool IsIdSelector { get; }
Gets a value indicating whether this style defines a CSS id.

IsPluralSelector

#
public bool IsPluralSelector { get; }
Gets a value indicating whether this style targets multiple selectors.

Properties

#
public ReadOnlyCollection<GH_CssProperty> Properties { get; }
Gets all the properties in this CSS style.

Selector

#
public string Selector { get; set; }
Gets or sets the selector field for this property.

Methods

AddComment

#
public void AddComment(string comment)
Add a comment to this style.
comment (string)Comment to add.

AddProperty

#
public void AddProperty(GH_CssProperty property)
Add a property to this style. If the new property conflicts with an existing property, it will not be added.
property (GH_CssProperty)Property to add.

AddProperty

#
public void AddProperty(string name, string value)
name (string)
value (string)

CompareTo

#
public int CompareTo(GH_CssStyle other)
Compare this CSS style to another one. Comments are ignored in the comparison.
other (GH_CssStyle)Style to compare to.

FormatCss

#
public string FormatCss(int indent)
Format the style as CSS code.
indent (int)Indentation depth of style.
A CSS 2.0 compliant style block.