To remove the border of an <iframe> element in HTML, you can set the border property to 0 or none using CSS. Here are two methods to achieve this:
Method 1: Directly use the style attribute within the iframe tag
html<iframe src="example.html" style="border:none;"> </iframe>
or
html<iframe src="example.html" style="border:0;"> </iframe>
Method 2: Use a CSS file or <style> tag
In CSS, define a class for the iframe element and set the border property to 0 or none for that class.
html<style> .no-border { border: none; } </style> <iframe class="no-border" src="example.html"></iframe>
Alternatively, to remove the border for all iframe elements on the page, directly apply styles to the iframe element:
html<style> iframe { border: 0; } </style> <iframe src="example.html"></iframe>
Choose the appropriate method based on your specific needs. If your iframe is dynamically created using JavaScript, set the border property of the style attribute when creating the iframe element.