Is the <p> element for small amounts of text semantically correct

I always wondered if the elements are <p>semantically correct for a small amount of text.

When I think of a paragraph, I actually render a large piece of text.

In the example below, I used an element <p>to display the password strength of the user input password in the registration form.

<div class="inputs">
    <div class="field">
        <input id="firstname" type="text" name="firstname" placeholder="First" />
        <input id="lastname" type="text" name="lastname" placeholder="Last" />
    </div>
    <div class="field">
        <input id="email" type="email" name="email" />
    </div>
    <div class="field">
        <input id="email-confirm" type="email" name="email" autocomplete="off" />
    </div>
    <div class="field">
        <input id="password" type="password" name="password" />
        <p>Password strength: Weak</p>
    </div>
</div>        
+4
source share
2 answers

The HTML5 specification states that

- , , , , , , . , , , .

. , , inline pilcrows (¶).

, , , <p>, .

<span> , , , <label>.

, <div class="field"> , <div> <p> .

+1

, <p> , . , , , , , . , , .

<p>Password strength: Weak</p> , <label> <dd> , <input>.

0

Source: https://habr.com/ru/post/1535985/


All Articles