New-HTMLTag
Creates a new HTML tag with specified attributes and content.
Syntax
New-HTMLTag [-Attributes <IDictionary>] [-NewLine] [-NoClosing] [-SelfClosing] [-Tag] <String> [[-Value] <ScriptBlock>] [<CommonParameters>]#All Parameter SetsDescription
The New-HTMLTag function creates a new HTML tag with the specified tag name, attributes, and content. It supports self-closing tags, custom attributes, and new line formatting.
Examples
EXAMPLE 1
New-HTMLTag -Tag "div" -Attributes @{ class = "container" } -Value { "Hello, World!" }Creates a <div> tag with the class attribute set to "container" and the content "Hello, World!".
EXAMPLE 2
New-HTMLTag -Tag "img" -Attributes @{ src = "image.jpg"; alt = "Image" } -SelfClosingCreates an <img> tag with the src and alt attributes set and is self-closing.
Parameters
- -Attributes IDictionary
- Specifies additional attributes for the HTML tag.
- -NewLine SwitchParameter
- Indicates whether a new line should be added after the HTML tag.
- -NoClosing SwitchParameter
- Indicates whether the HTML tag should not have a closing tag.
- -SelfClosing SwitchParameter
- Indicates whether the HTML tag is self-closing.
- -Tag String
- Specifies the name of the HTML tag to create.
- -Value ScriptBlock
- Specifies the content of the HTML tag as a script block.
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.