With the code below, I'm getting a double scroll bar - one for the iframe itself and one for the web page. I am looking for suggestions/solutions to only have one scroll bar, which would be associated with the entire page, not the iframe. My original thought process was to determine the size of the browser using javascript, then use that as the iframe tag height.
HTML:
<body>
<header>
<div class="container">
<a href = "index"><img id='logo' src='logo.png' style="width:230px;height:237;"/></a>
<nav>
<ul>
<li><a href="link1">link1</a></li>
<li><a href="link2">link2</a></li>
<li><a href="link3">link3</a></li>
</ul>
</nav>
</div>
</header>
<div class = "iframe-content">
<iframe src ="https://NeedToScrollToSeeContent.com" width= 100% height= 1000 style="text-align:center" frameborder="0"></iframe>
</div>
</body>
CSS:
body{
margin: 0;
background: #222;
font-family: 'Work Sans', sans-serif;
font-weight: 400;
}
header {
background: #ffffff;
position: relative;
}
.container {
width: 80%;
margin: 0 auto;
}
.iframe-content {
position: absolute;
top: 100px;
left: 0;
right: 0;
bottom: 0;
}
.iframe-content iframe {
display: block;
width: 100%;
height: 100%;
border: none;
}
Things I've tried:
- In the html iframe tag, I took out
height = 1000
. This shrunk the iframe to a very small portion of the page. I also replaced in the html iframe tagheight = 1000
withheight = 100%
and still got the same issue. - As mentioned above, I used javascript to determine the height of the browser and used that to determine the height attribute within the iframe tag. That did work, but it gave me a scroll bar only for the iframe, not the entire page.
Do note that I have taken a look at this similar question and implemented it into my code.