HTML <iframe> Tag
Voorbeeld
'n Inlynraam is soos volg gemerk:
<iframe src="https://www.w3schools.com" title="W3Schools Free
Online Web Tutorials"></iframe>
Meer "Probeer dit self" voorbeelde hieronder.
Definisie en gebruik
Die <iframe>
merker spesifiseer 'n inlynraam.
'n Inlynraam word gebruik om 'n ander dokument binne die huidige HTML-dokument in te sluit.
Wenk: Gebruik CSS om die <iframe>
(sien voorbeeld hieronder).
Wenk: Dit is 'n goeie praktyk om altyd 'n titelkenmerk vir die <iframe>
. Dit word deur skermlesers gebruik om uit te lees wat die inhoud van die <iframe>
is.
Blaaierondersteuning
Element | |||||
---|---|---|---|---|---|
<iframe> | Yes | Yes | Yes | Yes | Yes |
Eienskappe
Attribute | Value | Description |
---|---|---|
allow | Specifies a feature policy for the <iframe> | |
allowfullscreen | true false |
Set to true if the <iframe> can activate fullscreen mode by calling the requestFullscreen() method |
allowpaymentrequest | true false |
Set to true if a cross-origin <iframe> should be allowed to invoke the Payment Request API |
height | pixels | Specifies the height of an <iframe>. Default height is 150 pixels |
loading | eager lazy |
Specifies whether a browser should load an iframe immediately or to defer loading of iframes until some conditions are met |
name | text | Specifies the name of an <iframe> |
referrerpolicy | no-referrer no-referrer-when-downgrade origin origin-when-cross-origin same-origin strict-origin-when-cross-origin unsafe-url |
Specifies which referrer information to send when fetching the iframe |
sandbox | allow-forms allow-pointer-lock allow-popups allow-same-origin allow-scripts allow-top-navigation |
Enables an extra set of restrictions for the content in an <iframe> |
src | URL | Specifies the address of the document to embed in the <iframe> |
srcdoc | HTML_code | Specifies the HTML content of the page to show in the <iframe> |
width | pixels | Specifies the width of an <iframe>. Default width is 300 pixels |
Globale eienskappe
Die <iframe>
merker ondersteun ook die Global Attributes in HTML .
Gebeurtenis eienskappe
Die <iframe>
merker ondersteun ook die gebeurtenis-kenmerke in HTML .
Meer voorbeelde
Voorbeeld
Voeg iframe-grense by en verwyder (met CSS):
<iframe src="/default.asp" width="100%" height="300" style="border:1px solid
black;">
</iframe>
<iframe src="/default.asp" width="100%"
height="300" style="border:none;">
</iframe>
Verwante bladsye
HTML-tutoriaal: HTML Iframes
HTML DOM verwysing: IFrame Object
Verstek CSS-instellings
Die meeste blaaiers sal die <iframe>
element met die volgende verstekwaardes vertoon:
iframe:focus {
outline: none;
}
iframe[seamless] {
display: block;
}