# New-HTMLContainer

Creates a new HTML container element with customizable options.

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 container element with customizable options.

## Syntax

```
New-HTMLContainer
[-AnchorName <String>]
[-Density <Spacious|Comfortable|Compact|Dense|VeryDense>]
[[-HTML] <ScriptBlock>]
[-Margin <String>]
[-Width <Object>]
[<CommonParameters>]
```

[#](#method-new-htmlcontainer-string-string-scriptblock-string-object)

Parameter set: `All Parameter Sets`

## Description

This function creates a new HTML container element with the specified options such as content, width, margin, and anchor name.

## Examples

### Example 1

```powershell
New-HTMLContainer -HTML {
    // HTML content here
} -Width '50%' -Margin '10px' -AnchorName 'myAnchor'
```

Creates a new HTML container with custom HTML content, width of 50%, margin of 10px, and anchor name 'myAnchor'.

### Example 2

```powershell
New-HTMLContainer -HTML {
    // More HTML content
}
```

Creates a new HTML container with additional HTML content and default width and margin.

## Parameters

**-AnchorName String optional**

Specifies the anchor name for the container. If not provided, a random anchor name will be generated.

**-Density String optional**

Specifies the density of the panel. This will automatically enable responsive wrapping for the panel. The options are: Spacious, Comfortable, Compact, Dense, VeryDense.

Possible values: `Spacious`, `Comfortable`, `Compact`, `Dense`, `VeryDense`

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

Specifies the content to be placed inside the container as a ScriptBlock.

**-Margin String optional**

Specifies the margin of the container.

**-Width Object optional**

Specifies the width of the container. Default is '100%'.

## 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:BC98A40547C802EDE2C22FF9E12ECA973A399EAFA854F367B9809B3F6AD02D29 -->
