Command
New-HTMLSpanStyle
Creates an HTML <span> element with specified styling.
Syntax
New-HTMLSpanStyle
[[-Alignment] <left| center| right| justify>]
[[-BackGroundColor] <String>]
[[-Color] <String>]
[[-Content] <ScriptBlock>]
[[-Direction] <rtl>]
[[-Display] <String>]
[[-FontFamily] <String>]
[[-FontSize] <Object>]
[[-FontStyle] <normal| italic| oblique>]
[[-FontVariant] <normal| small-caps>]
[[-FontWeight] <String>]
[-LineBreak]
[[-LineHeight] <String>]
[[-Opacity] <Double>]
[[-TextDecoration] <line-through| overline| underline>]
[[-TextTransform] <uppercase| lowercase| capitalize>]
[<CommonParameters>]#Parameter set:
All Parameter SetsDescription
The New-HTMLSpanStyle function generates an HTML <span> element with customizable styling options such as color, background color, font size, font weight, font style, alignment, text decoration, text transformation, and more.
Examples
Example 1
New-HTMLSpanStyle -Content { "Hello, World!" } -Color 'red' -FontSize '12px' -FontWeight 'bold' -Alignment 'center'
Creates a <span> element with red text, font size of 12 pixels, bold weight, and centered alignment containing the text "Hello, World!".Example 2
New-HTMLSpanStyle -Content { "This is underlined text" } -Color 'blue' -TextDecoration 'underline'
Creates a <span> element with blue text and underlined decoration containing the text "This is underlined text".Parameters
- -Alignment String
- The alignment of the text within the <span> element.
- Possible values:
left,center,right,justify - -BackGroundColor String
- The background color of the <span> element.
- -Color String
- The color of the text.
- -Content ScriptBlock
- The content to be placed within the <span> element.
- -Direction String
- The direction of the text.
- Possible values:
rtl - -Display String
- The display style of the <span> element.
- Possible values:
inline,block,inline-block,contents,flex,grid,inline-flex,inline-grid,inline-table,list-item,run-in,table,table-caption,table-column-group,table-header-group,table-footer-group,table-row-group,table-cell,table-column,table-row - -FontFamily String
- The font family to be used.
- -FontSize Object
- The font size of the text.
- -FontStyle String
- The style of the font.
- Possible values:
normal,italic,oblique - -FontVariant String
- The variant of the font.
- Possible values:
normal,small-caps - -FontWeight String
- The weight of the font.
- Possible values:
normal,bold,bolder,lighter,100,200,300,400,500,600,700,800,900 - -LineBreak SwitchParameter
- Indicates whether to allow line breaks within the <span> element.
- -LineHeight String
- The height of each line of text.
- -Opacity Double
- The opacity of the <span> element.
- -TextDecoration String
- The decoration to be applied to the text.
- Possible values:
line-through,overline,underline - -TextTransform String
- The transformation to be applied to the text.
- Possible values:
uppercase,lowercase,capitalize
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.