new503
new503

Reputation: 23

Pinterest image height

<div class="pin_image">

   <a href="<?php the_permalink(); ?>"><img width="191" height="auto" class="<?php echo $img_class; ?>" 
                src="<?php echo PricerrTheme_get_first_post_image(get_the_ID(),102,72); ?>" /></a>
</div>  

How do I make images above to dynamically generate height based on aspect ratio of picture? Width will be 191px. Just like pinterest.

Upvotes: 1

Views: 236

Answers (1)

ZettaGeek
ZettaGeek

Reputation: 309

Basically, you need to set height to AUTO from CSS, instead of using the HTML4 tag width property. Using inline styles (which are never a good idea IMO, except for demonstration purposes.), edit your code to look like this:

<img src="blah.png" style="width:100px; height:auto;" />

Good luck with your project! :)

Upvotes: 1

Related Questions