Skip to content

Instantly share code, notes, and snippets.

@mparker17
Last active June 21, 2019 19:12
Show Gist options
  • Save mparker17/7792825 to your computer and use it in GitHub Desktop.
Save mparker17/7792825 to your computer and use it in GitHub Desktop.
HTML5 tags that could be used for general content entry on a typical Drupal site — for filter_xss() or filter.module's "Limit allowed HTML tags" filter.

Important notes:

The purpose of this list is to help you evaluate which tags to allow guest contributors to your CMS to use, so...

  • It doesn't list all available elements. Notably, it's missing the tags that deal with text-direction, ruby markings, advanced media tags, form elements, and HTML document structure tags.
  • It's not designed to be super-detailed or technically-correct. There are really detailed, technically-correct groupings of elements available if you want them.

... so, no hatin' please :)

Everyone knows these

<a>
<br>
<em>
<h1>
<h2>
<h3>
<h4>
<h5>
<h6>
<hr>
<img>
<p>
<strong>
<sub>
<sup>

Retro elements added back into HTML5

Used when things are typically formatted a certain way but carry no additional semantic meaning.

<b>
<i>
<s>
<small>
<u>

Showing edits

<del>
<ins>
<mark>

Tables

<caption>
<col>
<colgroup>
<table>
<tbody>
<td>
<tfoot>
<th>
<thead>
<tr>

Lists

<dd>
<dl>
<dt>
<li>
<ol>
<ul>

"Invisible" inline semantic hints

A number of these are technically visible because they have subtle styles in certain browser's default stylesheets.

<abbr>
<cite>
<data>
<dfn>
<kbd>
<pre>
<q>
<samp>
<time>
<var>

Grouping

Typically block-level.

<address>
<aside>
<blockquote>
<code>
<section>

Details

<details>
<summary>

Figures

<figcaption>
<figure>

Generic grouping

<div>
<span>
# Note this is a fairly relaxed list, e.g.: permitting links, embedding images, etc. so you should probably only grant it to privileged users.
<a> <abbr> <acronym> <address> <aside> <b> <blockquote> <br> <caption> <cite> <code> <col> <colgroup> <data> <dd> <del> <details> <dfn> <div> <dl> <dt> <em> <figcaption> <figure> <h1> <h2> <h3> <h4> <h5> <h6> <hr> <i> <img> <ins> <kbd> <li> <mark> <ol> <p> <pre> <q> <s> <samp> <section> <small> <span> <strong> <sub> <summary> <sup> <table> <tbody> <td> <tfoot> <th> <thead> <time> <tr> <u> <ul> <var>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment