This webpage contains images inserted by WordPress. The code used to insert the first image is:
<a href="http://steven.doig.com.au/files/2013/06/Forest_Legacy_m.jpg">
<img class="size-large wp-image-887" alt="a Forest Legacy group" src="http://steven.doig.com.au/files/2013/06/Forest_Legacy_m-1024x681.jpg" width="1024" height="681" />
</a> a Forest Legacy group
This image is controlled by CSS:
#content .wp-caption a img {
width: 614px;
height: auto;
}
I want to make this image responsive. I’ve inserted the CSS:
@media (max-width:988px) {
#content .wp-caption a img {
width: 99.03225806%; /* 614/620 */
height: auto;
}
}
However, the DIV.wp-caption remains at 604px, as specified inside the WordPress post. I’ve tried specifying this as a percentage (97.41935483%) but WordPress reinterpreted it as 104px.
The inline CSS is overriding the CSS I insert into the stylesheet.
<div id="attachment_887" class="wp-caption alignnone" style="width: 614px">
Any ideas on how I can make the .wp-caption responsive?
You’re going to want to use:
Another possibility is to change the shortcode output so that the width is no longer hard-coded. Modifying the Codex example to have no width:
http://codex.wordpress.org/Function_Reference/add_filter#Example
Here’s a much simpler and cleaner solution:
works 😉 thanks