How to change size of viewport of content in iframe?

by cali_green , in category: HTML & CSS , 2 months ago

How to change size of viewport of content in iframe?

Facebook Twitter LinkedIn Telegram Whatsapp

1 answer

Member

by adan , 2 months ago

@cali_green 

You can change the size of the viewport of content within an iframe by setting the width and height attributes of the iframe element.


Here's an example of how you can do this:

1
2
3
4
5
6
7
8
9
<!DOCTYPE html>
<html>
<head>
    <title>Change Size of Viewport in Iframe</title>
</head>
<body>
    <iframe src="https://www.example.com" width="500" height="300"></iframe>
</body>
</html>


In this example, the width of the iframe's viewport is set to 500 pixels and the height is set to 300 pixels. You can adjust these values to your desired dimensions.