Select-HtmlStyleUsage

August 3, 2026 ยท View on GitHub

SYNOPSIS

Reports whether CSS selectors from inline or supplied CSS match elements in an HTML document.

SYNTAX

Node (Default)

Select-HtmlStyleUsage [-HtmlNode] <Object> [-CssContent <string>] [-CssPath <string>] [-UsedOnly] [-MaxMatchedElements <int>] [<CommonParameters>]

Content

Select-HtmlStyleUsage -Content <string> [-CssContent <string>] [-CssPath <string>] [-UsedOnly] [-MaxMatchedElements <int>] [<CommonParameters>]

File

Select-HtmlStyleUsage -Path <string> [-CssContent <string>] [-CssPath <string>] [-UsedOnly] [-MaxMatchedElements <int>] [<CommonParameters>]

Url

Select-HtmlStyleUsage -Url <uri> [-CssContent <string>] [-CssPath <string>] [-UsedOnly] [-MaxMatchedElements <int>] [-Proxy <string>] [-ProxyCredential <pscredential>] [<CommonParameters>]

DESCRIPTION

Reports whether CSS selectors from inline or supplied CSS match elements in an HTML document.

EXAMPLES

EXAMPLE 1

Select-HtmlStyleUsage -Content $html | Where-Object IsUsed -EQ $false

EXAMPLE 2

Select-HtmlStyleUsage -Content $html -CssPath .\site.css -UsedOnly

EXAMPLE 3

Select-HtmlNode -Content $html -CssSelector 'main' | Select-HtmlStyleUsage -MaxMatchedElements 3

PARAMETERS

-Content

HTML content to inspect.

Type: String
Parameter Sets: Content
Aliases: None
Possible values:

Required: True
Position: named
Default value: None
Accept pipeline input: True (ByValue, ByPropertyName)
Accept wildcard characters: False

-CssContent

CSS content to compare against the HTML. When omitted, inline style elements are used.

Type: String
Parameter Sets: Node, Content, File, Url
Aliases: None
Possible values:

Required: False
Position: named
Default value: None
Accept pipeline input: False
Accept wildcard characters: False

-CssPath

Path to a CSS file to compare against the HTML.

Type: String
Parameter Sets: Node, Content, File, Url
Aliases: None
Possible values:

Required: False
Position: named
Default value: None
Accept pipeline input: False
Accept wildcard characters: False

-HtmlNode

HtmlAgilityPack node or document to inspect.

Type: Object
Parameter Sets: Node
Aliases: Node, InputObject
Possible values:

Required: True
Position: 0
Default value: None
Accept pipeline input: True (ByValue)
Accept wildcard characters: False

-MaxMatchedElements

Maximum representative matched element selectors returned for each CSS rule.

Type: Int32
Parameter Sets: Node, Content, File, Url
Aliases: None
Possible values:

Required: False
Position: named
Default value: None
Accept pipeline input: False
Accept wildcard characters: False

-Path

Path to an HTML file.

Type: String
Parameter Sets: File
Aliases: File
Possible values:

Required: True
Position: named
Default value: None
Accept pipeline input: False
Accept wildcard characters: False

-Proxy

Proxy server address used when downloading by URL.

Type: String
Parameter Sets: Url
Aliases: None
Possible values:

Required: False
Position: named
Default value: None
Accept pipeline input: False
Accept wildcard characters: False

-ProxyCredential

Credentials used with the proxy server.

Type: PSCredential
Parameter Sets: Url
Aliases: None
Possible values:

Required: False
Position: named
Default value: None
Accept pipeline input: False
Accept wildcard characters: False

-Url

URL of an HTML page to download and inspect.

Type: Uri
Parameter Sets: Url
Aliases: Uri
Possible values:

Required: True
Position: named
Default value: None
Accept pipeline input: False
Accept wildcard characters: False

-UsedOnly

Returns only selectors that matched at least one element or had a selector error.

Type: SwitchParameter
Parameter Sets: Node, Content, File, Url
Aliases: None
Possible values:

Required: False
Position: named
Default value: None
Accept pipeline input: False
Accept wildcard characters: False

CommonParameters

This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see about_CommonParameters.

INPUTS

  • System.String
  • System.Object

OUTPUTS

  • HtmlTinkerX.HtmlStyleUsageItem
  • None