189

Using this code

<iframe frameborder="0" style="height: 185px; overflow:scroll; width: 100%" src="http://www.cbox.ws/box/?boxid=439&boxtag=7868&sec=main" marginheight="1" marginwidth="1" name="cboxmain" id="cboxmain" seamless="seamless" scrolling="no" frameborder="0" allowtransparency="true"></iframe>

This is how it appears (the shoutbox on homepage of http://www.talkjesus.com)

How do I remove the horizontal scrollbar and modify the css of the vertical scrollbar?

TylerH
  • 20,799
  • 66
  • 75
  • 101
Faith In Unseen Things
  • 2,033
  • 2
  • 12
  • 9
  • 3
    duplicate with http://stackoverflow.com/questions/4856746/hide-horizontal-scrollbar-on-an-iframe which has a better answer – Daniël Tulp Oct 21 '14 at 10:42

18 Answers18

453

Add scrolling="no" attribute to the iframe.

franzlorenzon
  • 5,845
  • 6
  • 36
  • 58
Dean Oakley
  • 5,366
  • 2
  • 18
  • 14
  • 1
    able to do this with css? – Evorlor Apr 07 '15 at 16:34
  • 1
    Yes, but then in Chrome can't use scrollIntoView. See https://code.google.com/p/chromium/issues/detail?id=137214 – Peter Brand Jun 09 '15 at 12:30
  • 1
    well, this hides the content's scrollbar, and prevents scrolling the content. it doesn't prevent the iframe's scrollbar from appearing. – Dave Cousineau Jun 22 '15 at 01:44
  • 4
    The scrolling attribute on the iframe is now officially obsolete. CSS should be used instead. – Mike Poole Nov 30 '17 at 18:12
  • 8
    @MikePoole It might be officially obsolete, but it didn't help setting `overflow:hidden;`on Chrome 65.0.3325.181, but `scrolling="no"` helped. – some Mar 30 '18 at 07:59
  • actually, this should be the accepted answer.... as a iframe property.... it works. – Pablo Contreras Jan 20 '21 at 03:58
  • 6
    This removed the scroll bar for me, but [W3C Nu Html Checker](https://validator.w3.org/nu/) now reports `The scrolling attribute on the iframe element is obsolete.` – Keyslinger Apr 02 '21 at 00:35
54

This works in all browsers

<iframe src="http://buythecity.com"  scrolling="no" style=" width: 550px; height: 500px;  overflow: hidden;" ></iframe>
Thyagarajan C
  • 7,915
  • 1
  • 21
  • 25
30

Adding scroll="no" and style="overflow:hidden" on iframe didn't work, I had to add style="overflow:hidden" on body of html document loaded inside iframe.

Mayank Pandeyz
  • 25,704
  • 4
  • 40
  • 59
nirvana74v
  • 1,021
  • 2
  • 15
  • 29
22

UPDATE:

seamless attribute has been removed in all major browsers


Just Add scrolling="no" and seamless="seamless" attributes to iframe tag. like this:-

 1. XHTML => scrolling="no"
 2. HTML5 => seamless="seamless"
Koen.
  • 25,449
  • 7
  • 83
  • 78
Nima Rahbar
  • 245
  • 2
  • 4
22

Try adding scrolling="no" attribute like below:

<iframe frameborder="0" scrolling="no" style="height:380px;width:6000px;border:none;" src='https://yoururl'></iframe>
Cà phê đen
  • 1,883
  • 2
  • 21
  • 20
Allabux B
  • 245
  • 2
  • 4
11

If anyone here is having a problem with disabling scrollbars on the iframe, it could be because the iframe's content has scrollbars on elements below the html element!

Some layouts set html and body to 100% height, and use a #wrapper div with overflow: auto; (or scroll), thereby moving the scrolling to the #wrapper element.

In such a case, nothing you do will prevent the scrollbars from showing up except editing the other page's content.

WraithKenny
  • 1,001
  • 13
  • 15
7

<iframe frameborder="0" scrolling="no" style="height:380px;width:6000px;border:none;" src='https://yoururl'></iframe>
Jakub Bujak
  • 79
  • 1
  • 2
  • Welcome to Stack Overflow! Your answer could be improved with additional supporting information. Please [edit] to add further details, such as citations or documentation, so that others can confirm that your answer is correct. You can find more information on how to write good answers in the [help center](https://stackoverflow.com/help/how-to-answer). – Ethan Jun 19 '22 at 20:46
6
<div id="myInfoDiv" seamless="seamless" scrolling="no" style="width:100%; height: 100%; float: left; color: #FFF; background:#ed8719; line-height:100%; font-size:100%; font-family: sans-serif>;

Use the above div and it will not show scroll bar in any browser.

Kamil Budziewski
  • 22,699
  • 14
  • 85
  • 105
KnightFury
  • 109
  • 1
  • 1
  • 7
    `seamless` attribute is not valid HTML5, not supported by most browsers (http://caniuse.com/#search=seamless), and most of the other styling is unnecessary. – Pere Apr 19 '16 at 15:00
6

It's the last resort, but worth mentioning:

You can use the ::-webkit-scrollbar pseudo-element on the iframe's parent to get rid of those famous 90's scroll bars.

::-webkit-scrollbar {
    width: 0px;
    height: 0px;
}

Edit: though it's relatively supported, ::-webkit-scrollbar may not suit all browsers. use with caution :)

Shaya
  • 2,792
  • 3
  • 26
  • 35
6
iframe {
  display: block;
  border: none;         /* Reset default border */
  height: 100vh;        /* Viewport-relative units */
  width: calc(100% + 17px);
}
div {
  overflow-x: hidden;
}

Like this you make the width of the Iframe larger than it should be. Then you hide the horizontal scrollbar with overflow-x: hidden.

Nico Grill
  • 129
  • 2
  • 6
5

Add this in your css to hide both scroll bar

iframe 
{
  overflow-x:hidden;
  overflow-Y:hidden;
}
NorthCat
  • 9,643
  • 16
  • 47
  • 50
Deepika Patel
  • 2,581
  • 2
  • 19
  • 13
4

in your css:

iframe{
    overflow:hidden;
}
takien
  • 1,056
  • 8
  • 11
4

Add this in your css to hide just the horizontal scroll bar

iframe{
    overflow-x:hidden;
}
Abhidev
  • 7,063
  • 6
  • 21
  • 26
2

None of the above answers worked for me. This is what I did in JS:

Select the iframe element:

var iframe_name = document.getElementById("iframe_name");

Add the attribute to it:

  iframe_name.scrolling = "no";
Dennis Kozevnikoff
  • 2,078
  • 3
  • 19
  • 29
0

Instead of iframe:

const blob = new Blob([data], { type: "application/pdf" });
const link = document.createElement("a");
const URL = window.URL.createObjectURL(blob);
link.href = URL;
link.download = filename;
//download the pdf
link.click();
//open the downloaded pdf in its default viewer
window.open(URL);
Tyler2P
  • 2,324
  • 26
  • 22
  • 31
-1

Using negative margin and overflow hidden to hide the scrollbar

<div class="scrollbar-hider" style="overflow:hidden">
        <div class="scrollbar-hider-margin" style="margin-right: -17px;">
            <iframe src="" 
                    style="display: block; 
                           overflow: hidden scroll; 
                           height:calc(100vh - 65px); 
                           width: 100%" 
                    frameborder="0" loading="lazy">
             </iframe>
        </div>
</div>
Charles C.
  • 3,725
  • 4
  • 28
  • 50
-1

seamless="seamless" scrolling="no"

are the two attributes that are used to remove the scroll bar and the faint line that borders the iframe.

You can combine this with other size restraining attributes to embed a page into another without it looking like you did. This helps to recreate data that you would normally have to recode and take up space on your server.

Finally, including anchors such as <href will allow you to direct the iframe to a specific portion of the page. You must of coarse create a call label on that page directed to the object.

Have fun!!!! :)

-2

When nothing works, float:left could safe you.

iframe{float:left; clear:both;}

Andrés
  • 1
  • 2