Supported HTML Tags

The framework supports most HTML tags, including the majority of HTML5 tags.

An HTML tag is treated as a first-class component by the framework. Each HTML tag is translated into an <aura:html> component, allowing it to enjoy the same rights and privileges as any other component.

For example, the framework automatically converts a standard HTML <div> tag to this component:

<aura:html tag="div" />

We recommend that you use components in preference to HTML tags. For example, use lightning:button instead of  <button>.

Components are designed with accessibility in mind so users with disabilities or those who use assistive technologies can also use your app. When you start building more complex components, the reusable out-of-the-box components can simplify your job by handling some of the plumbing that you would otherwise have to create yourself. Also, these components are secure and optimized for performance.

Note that you must use strict XHTML. For example, use <br/> instead of <br>.

Some HTML tags are unsafe or unnecessary. The framework doesn’t support these tags.

The HtmlTag enum in this open-source Aura file lists the supported HTML tags. Any tag followed by (false) is not supported. For example, applet(false) means the applet tag isn't supported.

Note

Note

The linked file is in the master branch of the open-source Aura project. The master branch is our current development branch and is ahead of the current release of the Lightning Component framework. However, this file changes infrequently and is the best place to see if a tag is supported now or in the near future.

Avoid # in the href Attribute of Anchor Tags

The hash mark (#) is a URL fragment identifier and is often used in Web development for navigation within a page. Avoid # in the href attribute of anchor tags in Lightning components as it can cause unexpected navigation changes, especially in the Salesforce1 mobile app. For example, use href="" instead of href="#".