HTML Reference

Quick Reference

An HTML <iframe> is used to create a rectangular region, including scrollbars and borders, in one web page to display another web page.

<iframe
    src="https://duckdcukgo.com" height="500" width="900" title="DDG Page">
    Sorry your browser does not support inline frames.
</iframe>

Attributes

The following attributes can be used within the <iframe> tag.

AttributeValueDescription
allowSpecifies a feature policy for the <iframe>
allowfullscreentrue
false
Set to true if the <iframe> can activate fullscreen mode by calling the requestFullscreen() method
allowpaymentrequesttrue
false
Set to true if a cross-origin <iframe> should be allowed to invoke the Payment Request API
heightpixelsSpecifies the height of an <iframe> (default height is 150 pixels)
loadingeager
lazy
Specifies whether a browser should load an iframe immediately or to defer loading of iframes until some conditions are met
nametextSpecifies the name of an <iframe>
referrerpolicyno-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
sandboxallow-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>
srcURLSpecifies the address of the document to embed in the <iframe>
srcdocHTML_codeSpecifies the HTML content of the page to show in the <iframe>
widthpixelsSpecifies the width of an <iframe> (default width is 300 pixels)

HTML Notes:

  • In our HTML section the term “tag” and “element” are often used interchangeably to refer to both the tag used to create a page element and the element created by the tag (<p> tag = <p> element = paragraph on the page)
  • HTML5 is not case sensitive; so <P> is the same as <p>, <H1> is the same as <h1>
  • Global attributes can be used with all HTML tags and are therefore not mentioned on every tag page
  • To write clean, readable HTML code, it is best to use indentation whereas elements within elements are indented (tabbed or spaces) to create something that looks like a project outline
  • The browser will automatically remove any extra spaces and lines in your HTML code when the page is displayed
  • Double quotes or single quotes can be used around HTML attribute values, but when the attribute value itself contains one form of quote, it will be necessary to use the other around the attribute

We’d like to acknowledge that we learned a great deal of our coding from W3Schools and TutorialsPoint, borrowing heavily from their teaching process and excellent code examples. We highly recommend both sites to deepen your experience, and further your coding journey. We’re just hitting the basics here at 1SMARTchicken.