---
title: HTML attributes
framework: foundation
role: collectionGroup
role_heading: API Collection
path: foundation/html-attributes
---

# HTML attributes

Documentwide attributes that provide control over the form of generated HTML.

## Overview

Overview You use these attributes only for writing HTML. excludedElements allows control over the tags used. The recognized values in the excludedElements array are (case-insensitive) HTML tags, plus DOCTYPE (representing a doctype declaration) and XML (representing an XML declaration). By default, if this attribute is not present, the excluded elements will be those deprecated in HTML 4 (APPLET, BASEFONT, CENTER, DIR, FONT, ISINDEX, MENU, S, STRIKE, and U) plus XML. If XML is on the list, HTML forms are used; if XML is not on the list, XHTML forms are used where there is a distinction. Either characterEncoding or textEncodingName may be used to control the encoding used for generated HTML; character entities are used for characters not representable in the specified encoding. prefixSpaces allows some control over formatting.

## Topics

### Getting the attributes

- [excludedElements](foundation/nsattributedstring/documentattributekey/excludedelements.md)
- [textEncodingName](foundation/nsattributedstring/documentattributekey/textencodingname.md)
- [prefixSpaces](foundation/nsattributedstring/documentattributekey/prefixspaces.md)

## See Also

### Getting document-wide attributes

- [NSAttributedString.DocumentAttributeKey](foundation/nsattributedstring/documentattributekey.md)
- [NSAttributedString.DocumentReadingOptionKey](foundation/nsattributedstring/documentreadingoptionkey.md)
- [NSAttributedString.DocumentType](foundation/nsattributedstring/documenttype.md)
- [NSAttributedString.TextLayoutSectionKey](foundation/nsattributedstring/textlayoutsectionkey.md)
- [NSTextScalingType](uikit/nstextscalingtype.md)
