Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Allow image to be wider than containing div

Is there any way to make a div not extend it's width, but make an image which is visible outside the div in IE8? For example, my div might be 200px wide, but the image 250px wide.

like image 698
Krish Avatar asked Jan 23 '12 11:01

Krish


People also ask

How do I stretch an image to fit in a div?

Answer: Use the CSS max-width Property You can simply use the CSS max-width property to auto-resize a large image so that it can fit into a smaller width <div> container while maintaining its aspect ratio.

How do I stretch an image into an IMG tag?

One of the simplest ways to resize an image in the HTML is using the height and width attributes on the img tag. These values specify the height and width of the image element. The values are set in px i.e. CSS pixels. For example, the original image is 640×960.

How do I resize a div by content?

Using inline-block property: Use display: inline-block property to set a div size according to its content.


1 Answers

You could position the image 'absolute'?

div > img {position:absolute;}
like image 111
Marc Costello Avatar answered Sep 25 '22 02:09

Marc Costello