cesbloggan
Member
Posted 12 months ago #
Hi,
I am tweaking TwentyTen and stumbled on a problem..
It seems that when inserting left-aligned pictures in pages WP adds: style="width: 650px" to the image which means an extra 10 px to the image's actual width. It doesn't show in html-mode either as it does if you add margin in the advanced preferences for the image.
Since it gets created directly in the page I can't take it away in the style-sheet. It doesn't make a change either to use negative margins in the style-sheet.
The result creates a 10px space to the left of the picture.
Where is it initiated? Any WP-guru out there to help?
afaik, this happens only for images with captions;
http://www.transformationpowertools.com/wordpress/adjust-caption-frame-width
can you post a link to your site to illustrate the problem?
cesbloggan
Member
Posted 12 months ago #
Thanks!
I read the post and copied the code into functions.php and it works like a charm!
Of course it was an image with a caption but I want to have the possibility of using captions and not having to add extra code to format regular text like a caption.
:-)
ryanve
Member
Posted 10 months ago #
The extra 10px can also be removed using jQuery. The code below sets the .wp-caption container width to match the width of the image inside it:
jQuery().ready(function() {
var width = jQuery(".wp-caption img").width();
jQuery(".wp-caption").width(width);
});
See this thread.
ryanve
Member
Posted 10 months ago #
Actually this version is more solid:
jQuery().ready(function( jQuery ) {
jQuery(".wp-caption").width(function() {
return jQuery('img', this).width();
});
});
See this thread.