тег внутри HTML <td>тега? (Bootstrrap 4) - PullRequest
2 голосов
/ 24 апреля 2020

Правильно ли иметь несколько <div> внутри тега <td> в таблице с bootstrap в данном случае, даже если это чисто вопрос HTML? Если нет, то какой правильный способ иметь описание di sh под ним, поскольку я не думаю, что было бы правильным поместить описание в другой <td>.

                  <div class="col">
                    <table class="table">
                        <thead class="thead-dark">
                          <tr>
                            <th scope="col" colspan="3" class="menuDishType text-center">Antipasti</th>
                          </tr>
                        </thead>
                        <tbody>
                          <tr>
                            <th scope="row">1</th>
                            <td>
                                <div class="menuDish">Bruschetta Mista</div>
                                <div class="menuDishDescription">(pain toasté, tomates fraîches, huile d’olive, ail, basilic et mozzarella di bufala)</div>
                            </td>
                            <td>13,00€</td>
                          </tr>
                          <tr>
                            <th scope="row">2</th>
                            <td>
                                <div class="menuDish">Crocchetta Di Fromaggio E Parma</div>
                                <div class="menuDishDescription">(croquette de fromage et jambon de Parme)</div>
                            </td>
                            <td>14,00€</td>
                          </tr>
                          <tr>
                            <th scope="row">3</th>
                            <td>
                                <div class="menuDish">Carpaccio Di Manzo Rucola E Grana</div>
                                <div class="menuDishDescription">(assiette de légumes)</div>
                            </td>
                            <td>16,00€</td>
                          </tr>
                          <tr>
                            <th scope="row">4</th>
                            <td>
                                <div class="menuDish">Piatto Di Verdure</div>
                                <div class="menuDishDescription">(assiette de légumes)</div>
                            </td>
                            <td>16,00€</td>
                          </tr>
                          <tr>
                            <th scope="row">5</th>
                            <td>
                                <div class="menuDish">Scampi A Scelta</div>
                                <div class="menuDishDescription">(scampi au choix : à l’ail, à la diable ou aux légumes) - 6 pièces</div>
                            </td>
                            <td>16,00€</td>
                          </tr>
                          <tr>
                            <th scope="row">6</th>
                            <td>
                                <div class="menuDish">Fantasia Dello Chef – 2 Pers.</div>
                                <div class="menuDishDescription">(assortiment d’entrées chaudes/froides, selon l’humeur du chef)</div>
                            </td>
                            <td>19,00€</td>
                          </tr>
                        </tbody>
                      </table>
                  </div>
              </div> ```

Ответы [ 2 ]

1 голос
/ 24 апреля 2020

Вы можете иметь несколько внутри тега, и это способ реализации normal.

Я только что проверил ваш HTML в https://validator.w3.org (многим клиентам требуется запустить это инструмент для проверки HTML/CSS/JS файла), он не показывает проблему о синтаксисе HTML.

  
  <link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.3.1/css/bootstrap.min.css" integrity="sha384-ggOyR0iXCbMQv3Xipma34MD+dH/1fQ784/j6cY/iJTQUOhcWr7x9JvoRxT2MZw1T" crossorigin="anonymous">

  <div class="col">
                    <table class="table">
                        <thead class="thead-dark">
                          <tr>
                            <th scope="col" colspan="3" class="menuDishType text-center">Antipasti</th>
                          </tr>
                        </thead>
                        <tbody>
                          <tr>
                            <th scope="row">1</th>
                            <td>
                                <div class="menuDish">Bruschetta Mista</div>
                                <div class="menuDishDescription">(pain toasté, tomates fraîches, huile d’olive, ail, basilic et mozzarella di bufala)</div>
                            </td>
                            <td>13,00€</td>
                          </tr>
                          <tr>
                            <th scope="row">2</th>
                            <td>
                                <div class="menuDish">Crocchetta Di Fromaggio E Parma</div>
                                <div class="menuDishDescription">(croquette de fromage et jambon de Parme)</div>
                            </td>
                            <td>14,00€</td>
                          </tr>
                          <tr>
                            <th scope="row">3</th>
                            <td>
                                <div class="menuDish">Carpaccio Di Manzo Rucola E Grana</div>
                                <div class="menuDishDescription">(assiette de légumes)</div>
                            </td>
                            <td>16,00€</td>
                          </tr>
                          <tr>
                            <th scope="row">4</th>
                            <td>
                                <div class="menuDish">Piatto Di Verdure</div>
                                <div class="menuDishDescription">(assiette de légumes)</div>
                            </td>
                            <td>16,00€</td>
                          </tr>
                          <tr>
                            <th scope="row">5</th>
                            <td>
                                <div class="menuDish">Scampi A Scelta</div>
                                <div class="menuDishDescription">(scampi au choix : à l’ail, à la diable ou aux légumes) - 6 pièces</div>
                            </td>
                            <td>16,00€</td>
                          </tr>
                          <tr>
                            <th scope="row">6</th>
                            <td>
                                <div class="menuDish">Fantasia Dello Chef – 2 Pers.</div>
                                <div class="menuDishDescription">(assortiment d’entrées chaudes/froides, selon l’humeur du chef)</div>
                            </td>
                            <td>19,00€</td>
                          </tr>
                        </tbody>
                      </table>
                  </div>
              </div>
1 голос
/ 24 апреля 2020

Вы можете использовать свой путь. Но вы также можете использовать отдельные div для своих строк вместо таблицы. Это зависит от вашего проекта. Вы можете использовать кнопки divs images et c внутри строк таблицы

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