Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do I set a custom viewport for an iframe?

Tags:

html

css

iframe

Okay. Actually, maybe the title makes no sense.

Please read:

I want to create an iframe with a custom width. Okay. Please try to understand.

I don't want the iframe to be responsive (the site embedded in the iframe is responsive) and I want it to appear like a shrunk picture.

I can give you some examples if you wish. Any idea how to do this?

like image 318
mehulmpt Avatar asked Apr 06 '14 13:04

mehulmpt


1 Answers

you can scale the iframe using css transform. for example, if you'd like to make the page within the iframe to display at half size..

iframe {
  transform: scale(0.5, 0.5);
  height: 1000px;
  width: 1000px;
}

<iframe src='http://www.google.com'></iframe>

That should display a 1000x1000 viewport of the page shrunk down to a 500x500 iframe.

like image 170
jared eiseman Avatar answered Sep 23 '22 03:09

jared eiseman