API Reference
ConvertTo-CascadingStyleSheets
Converts a hashtable of CSS properties into Cascading Style Sheets (CSS) format.
Remarks
The ConvertTo-CascadingStyleSheets function takes a hashtable of CSS properties and converts them into a CSS stylesheet format. It organizes the properties into selectors and declarations, ready to be used in styling HTML elements.
Examples
EXAMPLE 1
$CssProperties = @{
'color' = 'blue'
'font-size' = '16px'
'font-family' = 'Arial'
}
ConvertTo-CascadingStyleSheets -Css $CssProperties -Name '.myClass' -Comment 'Custom styles for myClass'
Converts the hashtable of CSS properties into a CSS stylesheet with the selector '.myClass' and a custom comment.
EXAMPLE 2
$CssProperties = @{
'background-color' = 'lightblue'
'border' = @{
'style' = 'solid'
'width' = '1px'
'color' = 'black'
}
}
ConvertTo-CascadingStyleSheets -Css $CssProperties -Name '#myDiv' -WithTags
Converts the CSS properties into a CSS stylesheet with the selector '#myDiv' and includes CSS style tags.
Common Parameters
This command supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable.
For more information, see about_CommonParameters.
Syntax
ConvertTo-CascadingStyleSheets [-Comment <String>] [-Css <IDictionary>] [-Name <String>] [-WithTags] [<CommonParameters>]
#
All Parameter SetsParameters
- Comment String
- Specifies an optional comment to be included in the CSS stylesheet.
- Css IDictionary
- Specifies the hashtable of CSS properties to be converted.
- Name String
- Specifies the name of the CSS selector to be used in the stylesheet.
- WithTags SwitchParameter
- Indicates whether to include CSS style tags around the generated CSS content. Default is false.