I have an iframe and I want it only to add a scrollbar when it is necessary to reveal more content. I've set overflow to "auto" on the iframe. This doesn't wo开发者_StackOverflow中文版rk in Chrome or IE:
Here's the html:
<!DOCTYPE html>
<html>
<head>
<meta content="text/html; charset=utf-8" http-equiv="Content-Type">
<title>Hide iFrame scrollbars</title>
<style type="text/css">
body{
height: 500px;
}
iframe{
overflow: auto;
height: 570px;
width: 1000px;
}
</style>
</head>
<body>
<iframe src="http://www.google.co.za"></iframe>
</body>
</html>
Things I've tried (and that have been suggested on SO): setting the parent element and the iframe's dimensions, setting scrolling="no" on the iframe, setting overflow to "hidden". All of these result in unwanted behaviour.
How do I get the scrollbar to appear only when needed?
This scroll in Chrome ( and i assume in IE too ) is setted by html ( or body , I don't remember exactly now ) element in iframe
精彩评论