how to style the scrollbar of on iframe?
There is no cross-browser way to style the scrollbars.
The code that you have only works in Internet Explorer, and only in quirks (non-standard) mode.
What you have in the iframe is isolated from the main page, you have to style the scrollbars on the page where they appear, i.e. in the page that you load in the iframe. Any styling that you apply to the main page does not affect what's in the iframe.
If you can't change the content of the page that you load in the iframe, it's not possible to style it's scrollbars.
Style iFrame SCROLLBARS
This is what I found:
The scrollbar-xxx-color property changes the color of the scrollbars.
(xxx = either base, face, track, arrow, highlight, shadow, 3dlight, and
darkshadow)
So the iframe's scrollbar color can be changed by using these into the BODY element of the page you have in your iframe. Not in the page where you add the <iframe ...
to, but the page that loads into the iframe.
Source: http://www.tagindex.net/css/frame/scrollbar_color.html
iframe scrollbar replace with my own design
Here's a good resource that I used to get it working in Webkit browsers:
But the bigger issue is the iFrame. If you own the content in the iFrame or can change the CSS in it then you are good to go. If you don't own stuff within the iFrame and are using the iFrame to pull in a page from another site then you won't be able to change the scrollbar from the original page.
Iframe Scrollbar css
This is the css to change the scrollbars in iframes in chrome
body {
position: absolute;
overflow-y: scroll;
overflow-x: hidden;
}
html {
overflow-y: auto;
background-color: transparent;
}
::-webkit-scrollbar {
width: 10px;
height: 10px;
display: none;
}
::-webkit-scrollbar-button:start:decrement,
::-webkit-scrollbar-button:end:increment {
height: 30px;
background-color: transparent;
}
::-webkit-scrollbar-track-piece {
background-color: #3b3b3b;
-webkit-border-radius: 16px;
}
::-webkit-scrollbar-thumb:vertical {
height: 50px;
background-color: #666;
border: 1px solid #eee;
-webkit-border-radius: 6px;
}
Problem changing scrollbar design in iframe
CSS of the parent frame cannot affect an iframe, you have to include it in the source of the page loaded by the iframe.
JavaScript of the parent frame can add CSS to the page in the iframe, if both pages come from the same origin (which seems to be the case in your example).
horizontal scrollbar in iframe
You told the element to be scrollable if an overflow exists in x-axis direction. If there is no overflow the scrollbar stays disabled.
If you want the content of the iframe to be wider, simply put the contents inside the iframe into a container with
.container {
width: 200%;
}
The iframe should have position: relative;
set.
Please confirm if this solves your problem.
Related Topics
How to Write A:Visited in Inline CSS
Twitter Bootstrap: White Space on Left and Right Side in Smaller Screen Widths
Why Does This Div Shift Down When Content Is Added
iOS Safari Transition Transform Not Working
How to Make a Svg Clippath with a <Path> Responsive
How to Set Height Property for Span
Print Page Count with Total Number of Pages Using CSS
Horizontal Centering Text Over Image via CSS
Css: Fit Relative Positioned Parent to Height of Absolute Positioned Child
How to Hack Unsupported Mix-Blend-Mode CSS Property
I Need to Remove the Horizontal Scrollbar on an Overflown <Div>
How to Style Qpushbutton's Checked State to Remove Grey Dots
Does Chrome Have Issue with Setting A:Visited CSS Properties