Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

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.

share|improve this question
add comment

2 Answers

up vote 0 down vote accepted

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;
}
share|improve this answer
    
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 :) –  Jamal_Jakson Apr 11 '12 at 13:01
add comment

Follow up to @OneTrickPony A:

You could also use a background image, resize the container accordingly and then add background-size: contain;.

share|improve this answer
    
Yeah, I thought of that but I wanted to see if doing it this way would possible. –  Jamal_Jakson Apr 11 '12 at 14:28
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.