user2571510
user2571510

Reputation: 11377

HTML: set max width for image within div

I have a page with several divs like the following using Bootstrap classes.

The divs and buttons adjust their width properly when the screen size changes. However, the image does not which then causes the image to overlap the underlying div when being watched on a small screen.

Is there any way I can set a max width for the image or do something so that it never exceeds the underlying div ? I tried adding height="auto" and width="80%" to the image but that didn't work.

<div class="txtcntr well well-large span4">
    <a href="queue.php" class="track" name="Check_Queue"><img src="images/icons/bl_Queue.png" alt="" /></a>
    <br /><br />
    <a href="queue.php" class="btn btn-primary btn-block btn-large track" name="Check_Queue">Check Queue</a>
</div>

Many thanks for any help with this, Tim.

Upvotes: 1

Views: 655

Answers (1)

Catalin Lungu
Catalin Lungu

Reputation: 139

You can try to add css property max-width: 100% for the image

Upvotes: 2

Related Questions