Can I somehow hide all but first 3 rows in table via CSS
only ? The table is filled by MySQL query and i don't know how long it can be. On button click i toggle it. In first i want to show only 3 rows and hide the rest. What i tryied is
.modal-body table tbody tr:nth-last-child(-n+5) {
display: none;
}
but in this case I am hiding only the last 5 rows. This number ( 5 in the example ) won't be static as i said. Thank in advance!
My table :
<table>
<thead>
<td class="p0 pl5 strong"><?=Yii::t('app','app.product')?></td>
<td class="p0 pl5 strong"><?=Yii::t('app','app.price')?></td>
<td class="p0 strong text-center"><?=Yii::t('app','app.Add')?></td>
</thead>
<?php if((isset($extras)) and !empty($extras)) {
foreach ($extras as $cnt => $extra) {
$cnt++;?>
<tr>
<td><?=$extra->title?></td>
<td><?= Yii::$app->moneyConvertor->getMoney($extra->getPrice()); ?></td>
<td class="p0">
<section title=".slideThree">
<div class="slideThree">
<input type="checkbox" value="<?=$extra->id?>" id="slideThree<?=$cnt?>" onchange="checkBoxValue(this, <?= $product->id ?>)" name="check" checked/>
<label for="slideThree<?=$cnt?>"></label>
</div>
</section>
</td>
</tr>
<?php }
}?>
</table>