@ArmyDone

Как скрыть таблицу с множеством tbody?

Есть таблица, которая должна наполовину быть скрыта и по кнопке открываться. Нашел кусок css кода для скрытия, на одной таблице работает, там просто 1 thead и 1 tbody, а во второй таблице куча tbody и этот кусок уже не работает, как его поменять, чтобы он скрывал первые 6 tbody?
Код таблицы
<table>
    <thead>
        <tr>
            <th>№</th>
            <th>имя</th>
        </tr>
        <tr>
            <td>1</td>
            <td>Вася</td>
        </tr>
    </thead>
    <tbody>
        <tr>
            <th>Деньги</th>
            <th>Марки</th>
        </tr>
        <tr>
            <td>1000</td>
            <td>2000</td>
        </tr>
    </tbody>
    <thead>
        <tr>
            <th>№</th>
            <th>имя</th>
        </tr>
        <tr>
            <td>2</td>
            <td>Петя</td>
        </tr>
    </thead>
    <tbody>
        <tr>
            <th>Деньги</th>
            <th>Марки</th>
        </tr>
        <tr>
            <td>1300</td>
            <td>2500</td>
        </tr>
    </tbody>
</table>

Кусок CSS для скрытия

[id^="all1"] {
    position: fixed;
    }
    [id^="all1"]:target + table a[href^="#all1"],
    [id^="all"]:not(:target) + table thead tr:nth-child(n+6), 
    [id^="all1"]:not(:target) + table tbody tr:nth-child(n+6), 
    [id^="all1"]:not(:target) + table a[href="#close1"] {
    display: none;
    }
  • Вопрос задан
  • 82 просмотра
Пригласить эксперта
Ответы на вопрос 1
Rsa97
@Rsa97
Для правильного вопроса надо знать половину ответа
В таблице может быть только один элемент thead.
In this order: optionally a caption element, followed by zero or more colgroup elements, followed optionally by a thead element, followed by either zero or more tbody elements or one or more tr elements, followed optionally by a tfoot element, optionally intermixed with one or more script-supporting elements [script, template].
Ответ написан
Комментировать
Ваш ответ на вопрос

Войдите, чтобы написать ответ

Войти через центр авторизации
Похожие вопросы