Question

I am using SharePoint 2010.

I have a content query web part and have created my own ItemStyle.xsl. In this item style I have some title, description and image. This image has a fixed width and height of 150px. Is it possible to set only a fixed width of 150px and scaled automatic height?

Was it helpful?

Solution

How to resize the image proportionally via CSS

Lets assume the following xsl is used for image rendering in ItemStyle.xsl:

<img class="image" src="{$SafeImageUrl}" title="{@ImageUrlAltText}">
</img>

then the following Css could be used to resize the image proportionally:

img.image {
    width:150px; 
    height: auto;
}
Licensed under: CC-BY-SA with attribution
Not affiliated with sharepoint.stackexchange
scroll top