In this section, we will see what the name attribute is and how to use it in HTML.
What is name Attribute in HTML <iframe> Tag?
The name attribute is used to set a name for the target <iframe> element.
This name can then later on be used in other languages like CSS and JavaScript to reference the target <iframe> element and apply any necessary modification.
HTML name Attribute in <iframe> Tag Syntax:
<iframe name = “name-of-the-iframe” src = “…”> </iframe>
<iframe> Tag name Attribute Values
The value we set for the name attribute will be represented as the name of that iframe and could be used to reference the element in other languages, like JavaScript.
Example: using name attribute in HTML <iframe> tag
See the Pen using name attribute in HTML <iframe> tag by Omid Dehghan (@odehghan) on CodePen.