AngleSharp by Florian Rappl

<PackageReference Include="AngleSharp" Version="0.6.1" />

 CssParser

public sealed class CssParser : IParser
The CSS parser. See http://dev.w3.org/csswg/css-syntax/#parsing for more details.
public bool IsAsync { get; }

Gets if the parser has been started asynchronously.

public bool IsQuirksMode { get; }

Gets if the quirks-mode is activated.

public ICssStyleSheet Result { get; }

Gets the resulting stylesheet of the parsing.

The event will be fired once an error has been detected.

public CssParser(string source, IConfiguration configuration = null)

Creates a new CSS parser instance with a new stylesheet based on the given source.

public CssParser(Stream stream, IConfiguration configuration = null)

Creates a new CSS parser instance with an new stylesheet based on the given stream.

public static CSSProperty ParseDeclaration(string declaration, IConfiguration configuration = null)

Takes a string and transforms it into a CSS declaration (CSS property).

public static IEnumerable<CSSMedium> ParseMediaList(string source, IConfiguration configuration = null)

Takes a string and transforms it into a stream of CSS mediums.

public static ICssRule ParseRule(string rule, IConfiguration configuration = null)

Takes a string and transforms it into a CSS rule.

public static ISelector ParseSelector(string selector, IConfiguration configuration = null)

Takes a string and transforms it into a selector object.

public static ICssStyleSheet ParseStyleSheet(string stylesheet, IConfiguration configuration = null)

Takes a string and transforms it into a CSS stylesheet.

public static CSSValue ParseValue(string source, IConfiguration configuration = null)

Takes a string and transforms it into a CSS value.

public void Parse()

Parses the given source code.

public Task ParseAsync()

Parses the given source asynchronously and creates the stylesheet.

public Task ParseAsync(CancellationToken cancelToken)

Parses the given source asynchronously and creates the stylesheet.