0

I have checked the other similar question asked by CodersSC which did not help. It'd be very helpful if any of you can take a look at this.

I used object tag to load a php page inside my page. The problem is, when the div (which contains the contents of the other page) grows more than 100%, it is scroll-able instead of growing more than the given height. the following is my html portion.

content.html

<div class='content'>
    <p>...</p>
    <hr class="gh" style="margin-left:0px; margin-top:3px;">
    <object class="comm" data="comments.php?id=1"></object>
</div>

contentcss.css

.content {
    background-color: #333;
    margin: 2% auto;
    padding: 22px 40px ;
    width: 1200px;
    height: auto;
}
.comm {
    position: relative;
    width: 100%;
    height: 100%;
    overflow: hidden;
}

i also tried the following in comm class inside my css:

.comm {
    position: relative;
    width: 100%;
    min-height: 100%;
    height: auto;
    overflow: hidden;
}

^this makes the div smaller for some reason.

surre5l
  • 27
  • 8
  • 1
    It's the object that scrolls, not the .content div. Objects and iframes don't automatically adjust themselves to the contents within. Can your contents page communicate with this page? Then you can use JavaScript to tell it what the height should be. – Mr Lister May 27 '18 at 19:18
  • how do i make the comm class larger instead of scrolling? – surre5l May 27 '18 at 19:22
  • i have edited my question :), is it correct now? – surre5l May 27 '18 at 19:24
  • You haven't mentioned if you can use JavaScript in the embedded page. In that case, this question already has an answer here: [Make iframe automatically adjust height according to the contents without using scrollbar?](https://stackoverflow.com/q/9975810/1016716) or here: [Adjust width height of iframe to fit with content in it](https://stackoverflow.com/q/819416/1016716). – Mr Lister May 27 '18 at 19:52
  • Note that the linked questions only mention iframes, but it works the same way for objects. – Mr Lister May 27 '18 at 19:53
  • oh i get it now thanks. ^.^ – surre5l May 27 '18 at 21:09

0 Answers0