1. Computing & Technology

Discuss in my forum

Does HTML 5 Use a Trailing Slash in Singleton Tags?

By , About.com Guide

Question: Does HTML 5 Use a Trailing Slash in Singleton Tags?

In XHTML, when you use a singleton tag like <br/> you are required to include a trailing slash in the element for valid XHTML.

Answer:

In HTML 5 a singleton tag or void element is a tag that does not require a closing tag to be valid. These include:

In HTML 5, the trailing slash is optional. But it is usually omitted from HTML 5 documents.

If you are writing XHTML, then the trailing slash in void elements is required.

©2012 About.com. All rights reserved.

A part of The New York Times Company.