Mir
Mir

Reputation: 1

Set limit size for div box

So I have this box with some values from database and when I add more values they come out from the box. Is there anyway to solve this?

<div class="check">
   <?php
     $result = mysqli_query($conn, "SELECT * FROM `material` WHERE id > 0");
     while($row = mysqli_fetch_assoc($result)):?>
       <input type="checkbox" value="<?php echo $row['id'];?>" name="tipo[]" 
       id="tipo"><label><?php echo $row['tipo'];?></label><br>
       <input type="number" name="quant[]" min="1" max="50" id="textnumber" 
       class="number" disabled="true" style="margin-left: 145px; margin-top: 
       -36px; width: 40px; position: absolute;">
   <?php endwhile?>
</div>

Upvotes: 0

Views: 443

Answers (1)

tschoffelen
tschoffelen

Reputation: 520

There's a few strange things in that snippet of code (i.e. I don't think the position: absolute on the input is required), but just to focus on your question:

I'm guessing you're using some CSS somewhere to set the height of the check div.

Add an overflow: hidden to that to hide anything that doesn't fit in the box:

.check {
   height: 100px;
   overflow: hidden;
}

Or use overflow: auto to make it scrollable when the content doesn't fit:

.check {
   height: 100px;
   overflow: auto;
}

Upvotes: 1

Related Questions