Home > Web Front-end > HTML Tutorial > How to make the height and width of iframe 100%_html/css_WEB-ITnose

How to make the height and width of iframe 100%_html/css_WEB-ITnose

WBOY
Release: 2016-06-24 12:17:51
Original
1398 people have browsed it

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>
Copy after login


Reply to discussion (solution)

This is highly adaptive and scales according to the content.





Untitled Document