I've built this responsive site on WordPress and got a little curious as to how I can set the post thumbnails in percentages. Any help would be much appreciated.
2 Answers
This is not possible, images must have real absolute sizes :)
A post thumbnail is essentially a different sized version of the image. While you can calculate how much for example 70% of 1024 is, and genereate a ~700px wide image, you cannot do this for each of your visitors. It would kill your host's CPU...
The closest thing you can do is to browser-resize images to fit their container:
img{
max-width: 100%;
height: auto;
}
-
That's what I'm doing now, I was just really curious to see if that could be done with WordPress or not. Thanks for confirming this for me :) Commented Apr 11, 2012 at 13:01
Follow up to @OneTrickPony A:
You could also use a background image, resize the container accordingly and then add background-size: contain;
.
-
Yeah, I thought of that but I wanted to see if doing it this way would possible. Commented Apr 11, 2012 at 14:28