force image to fit container (responsive, remove inline width)
-
I’m having weird trouble with one specific site and images.
Is there a way to force css max width over inline width attribute?
I’ve tried this with functions.php
add_filter( 'post_thumbnail_html', 'remove_thumbnail_dimensions', 10 ); add_filter( 'image_send_to_editor', 'remove_thumbnail_dimensions', 10 ); function remove_thumbnail_dimensions( $html ) { $html = preg_replace( '/(width|height)=\"\d*\"\s/', "", $html ); return $html; } update_option('image_default_link_type','file');
However it does not remove the inline width attributes for example in case if there is caption added to the image. Is there a way to remove those inline widths and heights permanently?
- The topic ‘force image to fit container (responsive, remove inline width)’ is closed to new replies.