Evotec

Project

PSWriteHTML

PSWriteHTML is an open-source PowerShell project with packages, release history, and working documentation.

Stars 995
Forks 114
Open issues 69
PowerShell Gallery downloads 7,436,513
Release v1.41.0
Language: PowerShell Updated: 2026-04-11

API Reference

Function

New-HTMLSpanStyle

Namespace PSWriteHTML

Creates an HTML <span> element with specified styling.

Remarks

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

Authored help example

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".
        

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

New-HTMLSpanStyle [-Alignment <left|center|right|justify>] [-BackGroundColor <String>] [-Color <String>] [-Content <ScriptBlock>] [-Direction <rtl>] [-Display <inline>] [-FontFamily <String>] [-FontSize <Object>] [-FontStyle <normal|italic|oblique>] [-FontVariant <normal|small-caps>] [-FontWeight <normal>] [-LineBreak] [-LineHeight <String>] [-Opacity <Double>] [-TextDecoration <line-through|overline|underline>] [-TextTransform <uppercase|lowercase|capitalize>] [<CommonParameters>]
#
Parameter set: All Parameter Sets

Parameters

Alignment String optionalposition: 9pipeline: Falsevalues: 4
The alignment of the text within the <span> element.
Possible values: left, center, right, justify
BackGroundColor String optionalposition: 2pipeline: False
The background color of the <span> element.
Color String optionalposition: 1pipeline: False
The color of the text.
Content ScriptBlock optionalposition: 0pipeline: False
The content to be placed within the <span> element.
Direction String optionalposition: 12pipeline: Falsevalues: 1
The direction of the text.
Possible values: rtl
Display String optionalposition: 13pipeline: Falsevalues: 20
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 optionalposition: 8pipeline: False
The font family to be used.
FontSize Object optionalposition: 3pipeline: False
The font size of the text.
FontStyle String optionalposition: 6pipeline: Falsevalues: 3
The style of the font.
Possible values: normal, italic, oblique
FontVariant String optionalposition: 7pipeline: Falsevalues: 2
The variant of the font.
Possible values: normal, small-caps
FontWeight String optionalposition: 5pipeline: Falsevalues: 13
The weight of the font.
Possible values: normal, bold, bolder, lighter, 100, 200, 300, 400, 500, 600, 700, 800, 900
LineBreak SwitchParameter optionalposition: namedpipeline: False
Indicates whether to allow line breaks within the <span> element.
LineHeight String optionalposition: 4pipeline: False
The height of each line of text.
Opacity Double optionalposition: 14pipeline: False
The opacity of the <span> element.
TextDecoration String optionalposition: 10pipeline: Falsevalues: 3
The decoration to be applied to the text.
Possible values: line-through, overline, underline
TextTransform String optionalposition: 11pipeline: Falsevalues: 3
The transformation to be applied to the text.
Possible values: uppercase, lowercase, capitalize