The name attribute is used to assign a name to an <iframe> element. It allows links and forms to target a specific iframe.
- Specifies a unique name for the iframe.
- Used with the target attribute to load content into the iframe.
- Helps identify and reference the iframe in webpages and forms.
Syntax:
<iframe name="name">Attribute Values
- name: It specify the name for the iframe element.
<!--Driver Code Starts-->
<!DOCTYPE html>
<html>
<head>
<style>
body {
text-align: center;
}
</style>
</head>
<!--Driver Code Ends-->
<body>
<h1 style="color:green">
GeeksforGeeks
</h1>
<h2>
HTML <Iframe>name Attribute
</h2>
<p>Content goes here</p>
<iframe src=""
height="200"
width="200"
name="myGeeks">
</iframe>
<br>
<a href="https://www.geeksforgeeks.org/community/"
target="myGeeks">
GeeksforGeeks Community
</a>
<p>Content goes here</p>
</body>
<!--Driver Code Starts-->
</html>
<!--Driver Code Ends-->
Note: The content in the iframe isn’t showing because the website has blocked it for security reasons. You can try using a different link that allows embedding.