I would like my images to be displayed wider than my wrapper/parent width but still be responsive with the browser window size. Currently, my wrapper width is 500px.
I'm able to achieve wider images by:
<p style="margin-left: -25%; margin-right: -25%;">
<img alt="My wide image" style="width: 100%;" src="wide_image.jpg"/>
</p>
The above gives an image width wider than parent/wrapper width, but, the image doesn't scale with the browser window; instead, the wrapper/parent width scales correctly, and a horizontal scroll bar appears in the browser to navigate the image from left to right.
Thank you in advance. :-)
Edit: added missing double quote as Elliott Post pointed out.
Edit2: the answer shown here scales the image with respect to the browser window, however it obscures text after the image and is the full width of the page rather than 25% extra on each side: Is there are way to make a child DIV's width wider than the parent DIV using CSS?
Edit3: Here is a modified jsbin from Roko C. Buljan: http://jsbin.com/sumoqigo/1/edit
</img>
?? no, img is a single-tag, no need to use a closing one. (<img src="myimage.jpg" alt="My wide image">
is quite enough. Also note thealt
tag you're missing.) – Roko C. Buljan