Home > Article > Web Front-end > How to make the height and width of iframe 100%_html/css_WEB-ITnose
The html code is as follows, there are 2 divs, one with a width of 200px. There is an Iframe in another div. No matter how I set the style, I cannot make the width of this Iframe automatically reach 100%. I can only set a fixed value. The current default Iframe width and height are very small, only about 200px.
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"><html><head> <title></title> <style type="text/css"> html, body { width: 100%; height: 100%; } </style> </head><body><div class="dtree" style="position: absolute; left: 0px; top: 0px; width: 200px; height: 100%; padding: 5px; overflow: auto;"></div><div style="position: absolute; left: 205px; top: 10px;" width="100%" height="100%"> <Iframe name="tt" style="height=100%; width=80%" src="" marginwidth="1" marginheight="1" scrolling="yes" frameborder="10"></Iframe></div></body></html>
fe7fd3910acfa52a63922838546e4d92065276f04003e4622c4fe6b64f465b88
This is highly adaptive and scales according to the content.
8d2c2a8eff5035fb68199fd4e653ca2c
68ccb177a5de0ef9542dde7d35bae727
93f0f5c25f18dab9d176bd4f6de5d30e
311075f8df6528d02b7e1c4d6494bab3
b2386ffb911b14667cb8f0f91ea547a7Untitled Document6e916e0f7d1e588d4f442bf645aedb2f
31dd1147c61894a8398786c506fa3b692cacc6d41bbb37262a98f745aa00fbf0
095f3f1f113ec447f6fd4c08c2f9e34a
9c3bca370b5104690d9ef395f2c5f8d1
080b747a20f9163200dd0a7d304ba388
html, body
{
width: 100%;
height: 100%; /style>
6c04bd5ca3fcae76e30b72ad730ca86d
1daeb6ab92e52750e561e4fece39dc37
16b28748ea4df4d9c2150843fecfba68
5e31ec7685e4bf363b8bc26db2c8a1ed
28c53a39c2eb77b9734624a5af6bdb0847339a95073fc7313e65a7a8ddc71270
16b28748ea4df4d9c2150843fecfba68
36cc49f0c466276486e50c850b7e4956
73a6ac4ed44ffec12cee46588e518a5e