搜索

耀世资讯

公司动态
行业新闻

联系我们

Contact us

电话:400-123-4567
Q Q:1234567890
邮箱:admin@youweb.com
地址:广东省广州市天河区88号

HTML <iframe> Tag

发布时间:2025-08-14 06:16:26 作者:佚名
<div id='mainLeaderboard' style='overflow:hidden;'> </div> <div class="w3-clear w3-center nextprev"> <a class="w3-left w3-btn" href="https://www.w3schools.com/tags/tag_i.asp">&#10094;<span class="w3-hide-small"> Previous</span></a> <a class="w3-btn" href="https://www.w3schools.com/tags/default.asp"><span class="w3-hide-small">Complete HTML </span>Reference</a> <a class="w3-right w3-btn" href="https://www.w3schools.com/tags/tag_img.asp"><span class="w3-hide-small">Next </span>&#10095;</a> </div> <br> <div class="w3-example"> <p>An inline frame is marked up as follows:</p> <div class="w3-code notranslate htmlHigh"> <iframe src=https://www.w3schools.com/tags/"https://www.w3schools.com" title="W3Schools Free Online Web Tutorials"></iframe> </div> <a target="_blank" href="https://www.w3schools.com/tags/tryit.asp?filename=tryhtml_iframe" class="w3-btn w3-margin-bottom">Try it Yourself &raquo;</a> </div> <p>More "Try it Yourself" examples below.</p> <hr> <p>The tag specifies an inline frame.</p> <p>An inline frame is used to embed another document within the current HTML document.</p> <p><b>Tip:</b> Use CSS to style the (see example below).&nbsp;</p> <p><strong>Tip:</strong> It is a good practice to always include a title attribute for the . This is used by screen readers to read out what the content of the is.</p> <hr> <table class="browserref notranslate"> <tr> <th style="width:20%;font-size:16px;text-align:left;">Element</th> <th style="width:16%;" class="bsChrome" title="Chrome"></th> <th style="width:16%;" class="bsEdge" title="Internet Explorer / Edge"></th> <th style="width:16%;" class="bsFirefox" title="Firefox"></th> <th style="width:16%;" class="bsSafari" title="Safari"></th> <th style="width:16%;" class="bsOpera" title="Opera"></th> </tr> <tr> <td style="text-align:left;"><iframe></td> <td>Yes</td> <td>Yes</td> <td>Yes</td> <td>Yes</td> <td>Yes</td> </tr> </table> <hr> <table class="ws-table-all notranslate"> <tr> <th style="width:20%">Attribute</th> <th style="width:30%">Value</th> <th style="width:50%">Description</th> </tr> <tr> <td>allow</td> <td>&nbsp;</td> <td>Specifies a feature policy for the <iframe></td> </tr> <tr> <td>allowfullscreen</td> <td>true<br>false</td> <td>Set to true if the <iframe> can activate fullscreen mode by calling the requestFullscreen() method</td> </tr> <tr> <td>allowpaymentrequest</td> <td>true<br>false</td> <td>Set to true if a cross-origin <iframe> should be allowed to invoke the Payment Request API</td> </tr> <tr> <td><a href="https://www.w3schools.com/tags/att_iframe_height.asp">height</a></td> <td><i>pixels</i></td> <td>Specifies the height of an <iframe>. Default height is 150 pixels</td> </tr> <tr> <td>loading</td> <td>eager<br>lazy</td> <td>Specifies whether a browser should load an iframe immediately or to defer loading of iframes until some conditions are met</td> </tr> <tr> <td><a href="https://www.w3schools.com/tags/att_iframe_name.asp">name</a></td> <td><i>text</i></td> <td>Specifies the name of an <iframe></td> </tr> <tr> <td><a href="https://www.w3schools.com/tags/att_iframe_referrerpolicy.asp">referrerpolicy</a></td> <td>no-referrer<br>no-referrer-when-downgrade<br>origin<br> origin-when-cross-origin<br>same-origin<br>strict-origin-when-cross-origin<br>unsafe-url</td> <td>Specifies which referrer information to send when fetching the iframe </td> </tr> <tr> <td><a href="https://www.w3schools.com/tags/att_iframe_sandbox.asp">sandbox</a></td> <td>allow-forms<br>allow-pointer-lock<br>allow-popups<br> allow-same-origin<br> allow-scripts<br> allow-top-navigation</td> <td>Enables an extra set of restrictions for the content in an <iframe></td> </tr> <tr> <td><a href="https://www.w3schools.com/tags/att_iframe_src.asp">src</a></td> <td><i>URL</i></td> <td>Specifies the address of the document to embed in the <iframe></td> </tr> <tr> <td><a href="https://www.w3schools.com/tags/att_iframe_srcdoc.asp">srcdoc</a></td> <td><i>HTML_code</i></td> <td>Specifies the HTML content of the page to show in the <iframe></td> </tr> <tr> <td><a href="https://www.w3schools.com/tags/att_iframe_width.asp">width</a></td> <td><i>pixels</i></td> <td>Specifies the width of an <iframe>. Default width is 300 pixels</td> </tr> </table> <hr> <div id="midcontentadcontainer" style="overflow:auto;text-align:center"> </div> <hr> <p>The tag also supports the <a href="https://www.w3schools.com/tags/ref_standardattributes.asp">Global Attributes in HTML</a>.</p> <hr> <p>The tag also supports the <a href="https://www.w3schools.com/tags/ref_eventattributes.asp">Event Attributes in HTML</a>.</p> <hr> <div class="w3-example"> <p>Add and remove iframe borders (with CSS):</p> <div class="w3-code notranslate htmlHigh"> <iframe src=https://www.w3schools.com/tags/"/default.asp" width="100%" height="300" style="border:1px solid black;"><br></iframe><br><br><iframe src=https://www.w3schools.com/tags/"/default.asp" width="100%" height="300" style="border:none;"><br></iframe></div> <a target="_blank" href="https://www.w3schools.com/tags/tryit.asp?filename=tryhtml_iframe_frameborder_css" class="w3-btn w3-margin-bottom">Try it Yourself &raquo;</a> </div> <hr> <p>HTML tutorial: <a href="https://www.w3schools.com/html/html_iframe.asp">HTML Iframes</a></p> <p>HTML DOM reference: <a href="https://www.w3schools.com/jsref/dom_obj_frame.asp">IFrame Object</a></p> <hr> <p>Most browsers will display the element with the following default values: </p> <div class="w3-example"> <div class="w3-code notranslate cssHigh"> iframe:focus { <br>&nbsp;&nbsp;outline: none;<br>}<br><br> iframe[seamless] { <br>&nbsp; display: block;<br>} </div> </div> <br> <br> <div class="w3-clear w3-center nextprev"> <a class="w3-left w3-btn" href="https://www.w3schools.com/tags/tag_i.asp">&#10094;<span class="w3-hide-small"> Previous</span></a> <a class="w3-btn" href="https://www.w3schools.com/tags/default.asp"><span class="w3-hide-small">Complete HTML </span>Reference</a> <a class="w3-right w3-btn" href="https://www.w3schools.com/tags/tag_img.asp"><span class="w3-hide-small">Next </span>&#10095;</a> </div> <div id="user-profile-bottom-wrapper" class="user-profile-bottom-wrapper" > <div class="user-authenticated w3-hide"> <a href="https://profile.w3schools.com/log-in?redirect_url=https%3A%2F%2Fmy-learning.w3schools.com" class="user-profile-btn user-profile-bottom-btn ga-bottom ga-bottom-profile" title="Your W3Schools Profile" aria-label="Your W3Schools Profile" target="_top" > <svg xmlns="http://www.w3.org/2000/svg" version="1.1" viewBox="0 0 2048 2048" class="user-profile-icon" aria-label="Your W3Schools Profile Icon" > <path d="M 843.500 1148.155 C 837.450 1148.515, 823.050 1149.334, 811.500 1149.975 C 742.799 1153.788, 704.251 1162.996, 635.391 1192.044 C 517.544 1241.756, 398.992 1352.262, 337.200 1470 C 251.831 1632.658, 253.457 1816.879, 340.500 1843.982 C 351.574 1847.431, 1696.426 1847.431, 1707.500 1843.982 C 1794.543 1816.879, 1796.169 1632.658, 1710.800 1470 C 1649.008 1352.262, 1530.456 1241.756, 1412.609 1192.044 C 1344.588 1163.350, 1305.224 1153.854, 1238.500 1150.039 C 1190.330 1147.286, 1196.307 1147.328, 1097 1149.035 C 1039.984 1150.015, 1010.205 1150.008, 950 1149.003 C 851.731 1147.362, 856.213 1147.398, 843.500 1148.155" stroke="none" fill="#2a93fb" fill-rule="evenodd" /> <path d="M 1008 194.584 C 1006.075 194.809, 999.325 195.476, 993 196.064 C 927.768 202.134, 845.423 233.043, 786 273.762 C 691.987 338.184, 622.881 442.165, 601.082 552 C 588.496 615.414, 592.917 705.245, 611.329 760.230 C 643.220 855.469, 694.977 930.136, 763.195 979.321 C 810.333 1013.308, 839.747 1026.645, 913.697 1047.562 C 1010.275 1074.879, 1108.934 1065.290, 1221 1017.694 C 1259.787 1001.221, 1307.818 965.858, 1339.852 930.191 C 1460.375 795.998, 1488.781 609.032, 1412.581 451.500 C 1350.098 322.327, 1240.457 235.724, 1097.500 202.624 C 1072.356 196.802, 1025.206 192.566, 1008 194.584" stroke="none" fill="#0aaa8a" fill-rule="evenodd" /> </svg> <svg xmlns="http://www.w3.org/2000/svg" class="user-progress" aria-label="Your W3Schools Profile Progress" > <path class="user-progress-circle1" fill="none" d="M 25.99650934151373 15.00000030461742 A 20 20 0 1 0 26 15" ></path> <path class="user-progress-circle2" fill="none" d="M 26 15 A 20 20 0 0 0 26 15" ></path> </svg> <span class="user-progress-star">&#x2605;</span> <span class="user-progress-point">+1</span> </a> </div> <div class="w3s-pathfinder -teaser user-anonymous w3-hide"> <div class="-background-image -variant-t2">&nbsp;</div> <div class="-inner-wrapper"> <div class="-main-section"> <div class="-inner-wrapper"> <div class="-headline">Track your progress - it's free!</div> <div class="-body"> <div class="-progress-bar"> <div class="-slider" style="width: 20%;">&nbsp;</div> </div> </div> </div> </div> <div class="-right-side-section"> <div class="-user-session-btns"> <a href="https://profile.w3schools.com/log-in?redirect_url=https%3A%2F%2Fpathfinder.w3schools.com" class="-login-btn w3-btn bar-item-hover w3-right ws-light-green ga-bottom ga-bottom-login" title="Login to your account" aria-label="Login to your account" target="_top" > Log in </a> <a href="https://profile.w3schools.com/sign-up?redirect_url=https%3A%2F%2Fpathfinder.w3schools.com" class="-signup-btn w3-button w3-right ws-green ws-hover-green ga-bottom ga-bottom-signup" title="Sign Up to Improve Your Learning Experience" aria-label="Sign Up to Improve Your Learning Experience" target="_top" > Sign Up </a> </div> </div> </div> </div> </div>
热线电话:400-123-4567
电子邮箱:admin@youweb.com
Q Q:1234567890
地址:广东省广州市天河区88号
备案号:
耀世娱乐-耀世平台-耀世加盟站

关注我们

Copyright © 2002-2017 耀世-耀世平台-耀世加盟站 版权所有

平台注册入口