html - The height of the body in the iframe is the same as the iframe -
i have question height of body in iframe .
body
block-level element,so if don't set height , nothing in body,the height of body 0;
now, find that, when body in iframe, it's height same iframe.(if iframe has it's own height)
for example: html file , iframe empty, it's height 500px
.
body in iframe empty too, it's height 500px
too.
why body empty it's height same iframe?
i see quirks mode
in blogs,but appear in html5
<!doctype html>
?
<!doctype html> <html lang="en"> <head> <meta charset="utf-8"> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <meta http-equiv="x-ua-compatible" content="ie=edge"> <title>document</title> <style> *{ margin:0; padding:0; } iframe{ width:500px; height:500px; } </style> </head> <body> <iframe src="" frameborder="0"></iframe> </body> <script> </script> </html>
i has same problem before, can answer question. body inside iframe took same height because inheriting parent height means iframe height whatever defined. example,
<iframe width="100%" height="300px"></iframe>
so height of body inside of iframe "300px".
Comments
Post a Comment