Table of Contents

Class CssParser

Namespace
SimpleSign.HtmlToPdf.Parsing
Assembly
SimpleSign.HtmlToPdf.dll

Parses CSS from <style> blocks and inline style attributes. Supports tag, .class, #id selectors, shorthand properties, and common length units.

public static class CssParser
Inheritance
CssParser
Inherited Members

Methods

CalculateSpecificity(string)

Calculates specificity of a CSS selector.

public static int CalculateSpecificity(string selector)

Parameters

selector string

Returns

int

ParseInlineStyle(string)

Parses an inline style attribute value into properties.

public static Dictionary<string, string> ParseInlineStyle(string style)

Parameters

style string

Returns

Dictionary<string, string>

ParseLength(string, float)

Parses a CSS length value to points. Returns null if unparseable. Percentages are returned as negative values for later resolution.

public static float? ParseLength(string value, float parentFontSize = 12)

Parameters

value string
parentFontSize float

Returns

float?

ParseStylesheet(string)

Parses a CSS stylesheet string into a list of rules.

public static List<CssRule> ParseStylesheet(string css)

Parameters

css string

Returns

List<CssRule>