How to remove iframe scrollbars?

Member

by denis , in category: Javascript , 3 months ago

How to remove iframe scrollbars?

Facebook Twitter LinkedIn Telegram Whatsapp

1 answer

by herminia_bruen , 3 months ago

@denis 

To remove the scrollbars from an <iframe> element, you can use the scrolling attribute or use CSS styling.


Method 1: Using the scrolling attribute

1
<iframe src="your_source_url" scrolling="no" frameborder="0"></iframe>


Setting the scrolling attribute to "no" will prevent the scrollbars from showing.


Method 2: Using CSS styling You can use CSS to remove the scrollbars:

1
2
3
iframe {
    overflow: hidden;
}


This CSS rule sets the overflow property to hidden, which hides any content that exceeds the dimensions of the iframe.


Note: The above methods will work if you have control over the iframe source. If the iframe content is on a different domain, you may encounter security restrictions that prevent you from modifying its appearance.