CSS styles for text links also affecting image links
I've been working on this one for about an hour now, and I'm about ready to pull my hair out. What seems like it should be a simple one or two lines of CSS apparently isn't. I have a Posterous blog with a custom theme I designed for a client, viewable here: http://phar-ma.com/
I obviously use CSS to style the text links in the posts. My problem is, the same styles are also being applied to images that have a larger version to view, since Posterous automatically turns them into links to the larger versions (the smaller images aren't turned into links). So basically I need to figure out how the return the styling of the link images to the same as the non-link images. Right now they have weird spacing and borders around them (because of the styles for the text links) and those change when you hover over them. They're also not centere开发者_Python百科d correctly. I've tried just about every piece of CSS code I know, and I've had absolutely no luck. I also searched on Google and found this: http://perishablepress.com/press/2008/10/14/css-remove-link-underlines-borders-linked-images/ but still no luck with that either.
So, if anyone has any ideas, I'd appreciate it. Thanks!
It's hard to do something like this without hacking apart the blog's source code.
I tend to use jQuery to address bugs like tihs. You can wait until after the page is done loading, then change the style of the links after Posterous has messed them up:
http://api.jquery.com/ready/
http://api.jquery.com/css/
$(document).ready(function() {
$('img').css({visibility:"hidden"});
});
精彩评论