allowfullscreen
an HTML attribute for the iframe tag

What does allowfullscreen attribute do in HTML?

Answers:

  • The allowfullscreen attribute in HTML is used with the <iframe> element to specify that the content within the iframe can be displayed in full-screen mode. When this attribute is present, it enables users to expand the iframe to occupy the entire screen, providing a more immersive experience for content such as videos, presentations, or interactive applications.

    The basic syntax for using the allowfullscreen attribute is:

    <iframe src="your-content-url" allowfullscreen></iframe>
    

    In this example, if the document loaded in the iframe supports full-screen functionality (like a video player), users can click a button (usually identified by a full-screen icon) to expand the iframe content to fill the screen.

    It's important to note that the allowfullscreen attribute does not require a value, but adding it as a boolean attribute (i.e., just including the attribute name) is sufficient to enable the feature.

Related Questions: