Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>I think the <a href="https://www.w3.org/TR/2017/REC-html52-20171214/textlevel-semantics.html#the-strong-element" rel="nofollow noreferrer"><code>strong</code> element</a> is an appropriate element for such messages.</p> <p>You could use <em>several</em> <code>strong</code> elements to indicate the importance of the message:</p> <pre><code>&lt;strong&gt;Login successfully.&lt;/strong&gt; &lt;!-- confirmation --&gt; &lt;strong&gt;&lt;strong&gt;Wrong login data.&lt;/strong&gt;&lt;/strong&gt; &lt;!-- warning/error --&gt; </code></pre> <p>If it’s stand-alone message for which a heading is warranted, use a <a href="https://www.w3.org/TR/2017/REC-html52-20171214/sections.html#the-section-element" rel="nofollow noreferrer"><code>section</code> element</a> instead of a <code>div</code>. In case of serious errors that apply to the whole page, it should be the first element on the page.</p> <p>Various variants are possible:</p> <pre class="lang-html prettyprint-override"><code>&lt;section class="message message-error"&gt; &lt;h1&gt;&lt;strong&gt;&lt;strong&gt;Error:&lt;/strong&gt; Wrong login data.&lt;/strong&gt;&lt;/h1&gt; &lt;p&gt;The username and/or password is wrong. Try …&lt;/p&gt; &lt;/section&gt; </code></pre> <pre class="lang-html prettyprint-override"><code>&lt;section class="message message-error"&gt; &lt;h1&gt;Error&lt;/h1&gt; &lt;p&gt;&lt;strong&gt;&lt;strong&gt;Wrong login data.&lt;/strong&gt;&lt;/strong&gt;&lt;/p&gt; &lt;p&gt;The username and/or password is wrong. Try …&lt;/p&gt; &lt;/section&gt; </code></pre> <pre class="lang-html prettyprint-override"><code>&lt;section class="message message-error"&gt; &lt;strong&gt;&lt;strong&gt;Wrong login data.&lt;/strong&gt;&lt;/strong&gt; &lt;/section&gt; </code></pre> <pre class="lang-html prettyprint-override"><code>&lt;section class="message message-error"&gt; &lt;p&gt;&lt;strong&gt;&lt;strong&gt;Wrong login data.&lt;/strong&gt;&lt;/strong&gt; Try …&lt;/p&gt; &lt;/section&gt; </code></pre> <p>Which one to use depends on the kind of message, if the exact error is know, if additional help text is provided, and if several message could come up at the same time.</p> <p>Note that you probably don't want to use a heading for messages that apply to a single <code>input</code> element (e.g. when the user didn't fill out a required field or entered wrong content etc.), as these error messages should be in the corresponding <code>label</code> or directly next to the <code>input</code> element.</p> <p>For accessibility, you should have a look at <a href="http://en.wikipedia.org/wiki/WAI-ARIA" rel="nofollow noreferrer">WAI-ARIA</a>. Maybe <code>aria-live="assertive"</code> might be an appropriate way to mark error messages.</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload