Guns_Roses
Guns_Roses

Reputation: 165

How to set the maximum height of CSS images?

How can I fix the height of this image here in this page :

The original size of the image is 196 x 196 px. But, when the image is loaded on the page, it is shown much bigger than this size.

How this image height can be set to maximum 280px?

Upvotes: 0

Views: 44

Answers (2)

Tushar
Tushar

Reputation: 87203

The reason is that the image is taking the dimensions of the container.

Use max-height

.advance-link img {
    max-height: 280px;
    width: auto;
}

See the snapshot of the edited properties on your site.

Snapshot

Upvotes: 0

AndrewL64
AndrewL64

Reputation: 16301

Yes you can add a limit to the height. Just add a custom class to the img tag like this:

<img class="someName" src="file path" />

And then add this to your css:

img.someName {
    max-height: 280px;
}

Upvotes: 0

Related Questions