<tr> тег не делает новую строку в HTML - PullRequest
0 голосов
/ 11 июня 2019

Я делал фиктивную страницу формы, но мой тег не работает, он помещает все в один ряд.Почему это так?Кроме того, заполнители в моем раскрывающемся меню, похоже, не работают, я хочу показать текст с надписью «день», «месяц», «год», когда на экране появится раздел «День рождения».Заранее спасибо enter image description here

<!DOCTYPE html>
<html>

<head>
  <title>Register</title>
</head>

<body>
  <h1>Register</h1>
  <form>
    <table>
      <tr>
        <label for="firstName"><b> First Name:	<input id="firstName" type="text" name="firstName" required></b></label>
        <label for="lastName"><b> Last Name:	<input id="lastname"type="text" name="lastName" required></b></label>
      </tr>
      <tr>
        <label for="male"><b>Male <input id="male" type="radio" name="gender"></b></label>
        <label for="female"><b>Female <input id="female" type="radio" name="gender"></b></label>
        <label for="other"><b>Other <input id="other" type="radio" name="gender"></b></label>
      </tr>
      <tr>
        <label for="email"><b> Email:	<input id="email" type="email" name="email" placeholder="email" required></b></label>
        <label for="password"><b> Password:	<input id="password"type="password" name="password" minlength="5" maxlength="10" placeholder="password" required></b></label>
      </tr>
      <tr>
        <label>Birthday:</label>
        <select name="day" placeholder="day">
          <option>1</option>
          <option>2</option>
          <option>3</option>
          <option>4</option>
          <option>5</option>
          <option>6</option>
          <option>7</option>
          <option>8</option>
        </select>
        <select name="month" placeholder="month">
          <option>jan</option>
          <option>feb</option>
          <option>mar</option>
          <option>apr</option>
          <option>may</option>
          <option>jun</option>
          <option>jul</option>
          <option>aug</option>
        </select>
        <select name="year" placeholder="year">
          <option>1992</option>
          <option>1882</option>
          <option>1986</option>
          <option>2016</option>
          <option>2009</option>
          <option>1973</option>
          <option>1642</option>
          <option>1558</option>
        </select>
      </tr>
      <tr>
        Agree to this text
        <input type="checkbox" name="Agree" required>
      </tr>
      <tr>
        <button>Go</button>
      </tr>
    </table>
  </form>

</body>

</html>

1 Ответ

0 голосов
/ 11 июня 2019

Недопустимая HTML-разметка для <table>, тег <td> в каждой строке является обязательным.

<!DOCTYPE html>
<html>

<head>
  <title>Register</title>
</head>

<body>
  <h1>Register</h1>
  <form>
    <table>
      <tr>
        <td>
          <label for="firstName"><b> First Name:  <input id="firstName" type="text" name="firstName" required></b></label>
          <label for="lastName"><b> Last Name:    <input id="lastname"type="text" name="lastName" required></b></label>
        </td>
      </tr>
      <tr>
        <td>
          <label for="male"><b>Male <input id="male" type="radio" name="gender"></b></label>
          <label for="female"><b>Female <input id="female" type="radio" name="gender"></b></label>
          <label for="other"><b>Other <input id="other" type="radio" name="gender"></b></label>
        </td>
      </tr>
      <tr>
        <td>
          <label for="email"><b> Email:   <input id="email" type="email" name="email" placeholder="email" required></b></label>
          <label for="password"><b> Password: <input id="password"type="password" name="password" minlength="5" maxlength="10" placeholder="password" required></b></label>
        </td>
      </tr>
      <tr>
        <td>
          <label>Birthday:</label>
          <select name="day" placeholder="day">
            <option>1</option>
            <option>2</option>
            <option>3</option>
            <option>4</option>
            <option>5</option>
            <option>6</option>
            <option>7</option>
            <option>8</option>
          </select>
          <select name="month" placeholder="month">
            <option>jan</option>
            <option>feb</option>
            <option>mar</option>
            <option>apr</option>
            <option>may</option>
            <option>jun</option>
            <option>jul</option>
            <option>aug</option>
          </select>
          <select name="year" placeholder="year">
            <option>1992</option>
            <option>1882</option>
            <option>1986</option>
            <option>2016</option>
            <option>2009</option>
            <option>1973</option>
            <option>1642</option>
            <option>1558</option>
          </select>
        </td>
      </tr>
      <tr>
        <td>
          Agree to this text
          <input type="checkbox" name="Agree" required>
        </td>
      </tr>
      <tr>
        <td>
          <button>Go</button>
        </td>
      </tr>
    </table>
  </form>

</body>

</html>
Добро пожаловать на сайт PullRequest, где вы можете задавать вопросы и получать ответы от других членов сообщества.
...