Is it possible to group form elements in "p"?

Say I have this code

<form action="#" method="get">
    <p>
        <label for="name">Name:</label>
        <input type="text" name="name" />
    </p>
    <p>
        <input type="submit" />
    </p>
</form>

Is semantics subtle for grouping elements with p ? Because my teacher (again .. I know ..: P) told me that p should be used only for the paragraph and that I should use the div , but since I can see, p is used a lot and almost everywhere.

The last opportunity I can think of is that <br />which, in my opinion, is the worst way.

So which one is best to use

  • wrap <div>
  • wrap <p>
  • <br /> at the end
+3
source share
7 answers

.

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

+9

, - , Prettier Accessible Forms, , , , .

, , <li>.

+5

, ( ) <div> <p> .

+1

<div class="field">...</div> <fieldset>...</fieldset> .

(submit/ reset/back/etc) <fieldset class="controls">...</fieldset>


( CFML, HTML , , , <form:edit id="MyField" label="My Field" ...etc... />, HTML-, .)

+1

. P = . , ? .

,

+1

<div/>, CSS.

, / . , ec.

0

, .

Fieldset (, , ) .

  • P , .
  • DIV - " -", , , .
  • BR , / .
0

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


All Articles