# New-HTMLTag

Creates a new HTML tag with specified attributes and content.

Project

PSWriteHTML

Generate HTML reports, dashboards, and emails from PowerShell without writing HTML, CSS, or JavaScript.

[View on GitHub](https://github.com/EvotecIT/PSWriteHTML) [Visit Website](#) [Releases](https://github.com/EvotecIT/PSWriteHTML/releases/tag/v1.41.0) [Changelog](#) [Get package](https://www.powershellgallery.com/packages/PSWriteHTML/1.40.0)

Stars **1,025**

Forks **114**

Open issues 

PowerShell Gallery downloads **7,576,901**

Release **v1.45.0**

Language: PowerShell Updated: 2026-11-19

Command 

**Module**

`PSWriteHTML`

Creates a new HTML tag with specified attributes and content.

## Syntax

```
New-HTMLTag
[-Attributes <IDictionary>]
[-NewLine]
[-NoClosing]
[-SelfClosing]
[-Tag] <String>
[[-Value] <ScriptBlock>]
[<CommonParameters>]
```

[#](#method-new-htmltag-idictionary-switchparameter-switchparameter-switchparameter-string-scriptblock)

Parameter set: `All Parameter Sets`

## Description

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

```powershell
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

```powershell
New-HTMLTag -Tag "img" -Attributes @{ src = "image.jpg"; alt = "Image" } -SelfClosing
```

Creates an <img> tag with the src and alt attributes set and is self-closing.

## Parameters

**-Attributes IDictionary optional**

Specifies additional attributes for the HTML tag.

**-NewLine SwitchParameter optional**

Indicates whether a new line should be added after the HTML tag.

**-NoClosing SwitchParameter optional**

Indicates whether the HTML tag should not have a closing tag.

**-SelfClosing SwitchParameter optional**

Indicates whether the HTML tag is self-closing.

**-Tag String requiredposition: 1**

Specifies the name of the HTML tag to create.

**-Value ScriptBlock optionalposition: 0aliases: Content**

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](https://learn.microsoft.com/powershell/module/microsoft.powershell.core/about/about_commonparameters).

Evotec API Reference Copyright 2026 Evotec Services

<!-- PowerForge markdown artifact sha256:AA2E883DD5EA098406B27E0EB98976C9DC29225966500695FC9401F8F0F3F5D0 -->
