横向/纵向的图像宽度不同

Image width different for landscape / portrait

我有一个 Tumblr 页面,其中所有图像的宽度都相同

img.photo_img {max-width: 500px}

有没有办法让肖像和风景的风格有所不同 也许正在研究他们的纵横比?

我很想拥有:

肖像:宽度 500 像素 横向:宽度 750px

谢谢。

您可以使用媒体查询来做到这一点

@media all and (orientation:portrait) {
    img.photo_img{max-width:500px;}
}
@media all and (orientation:landscape) {
    img.photo_img{max-width:750px;}

}

查看示例here