iFrame with automatic hight | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 2

iFrame with automatic hight

I build a website with an iFrame. The only problem is, that it doesn't fit to the browser's high. Is there somebody who knows an good code to solve that problem. It also should include a space below (around 25px). Code: <!DOCTYPE html> <html> <head> <title>Crafttopia.org</title> </head> <body> <div> <iFrame src="https://crafttopiainsel.wixsite.com/crafttopia" style="width:100%; height:642px; border:none;" frameborder="0" name="Page"> <p><b><big>iFrame wird von ihrem Browser nicht unterstützt!</big></b></p> <a href="https://crafttopiainsel.wixsite.com/crafttopia"> Besuchen sie uns stattdessen hier! </a> </iFrame> </div> </body> </html> (Text is written in German)

30th Jan 2017, 2:42 PM
Tim Sticha
Tim Sticha - avatar
1 Answer
+ 2
Just put: style="margin:0;" ... in your <body> tag ( it has default margin ) And to have 100% height at your <iframe> element, you can: - put '100vh', wich means 100% of viewport height - or put '100%', but add style rules definitions for <html> and <body> element with 'height:100%' ( works for older browsers which wouldn't support 'vh' unit ^^ ) As 'vh' unit, is 'vw', meaning percent of viewport width...
30th Jan 2017, 8:51 PM
visph
visph - avatar