How to set maximum width for image in iframe?

Member

by dana , in category: HTML & CSS , 3 months ago

How to set maximum width for image in iframe?

Facebook Twitter LinkedIn Telegram Whatsapp

1 answer

by cali_green , 3 months ago

@dana 

To set a maximum width for an image within an iframe, you can use the following CSS code:

1
2
3
iframe img {
   max-width: 100%; 
}


This code sets the maximum width of the image inside the iframe to be 100% of its container. This means that the image will resize to fit the width of the iframe while maintaining its aspect ratio. You can adjust the percentage value as needed to set the maximum width to your desired size.