SitePoint Sponsor

User Tag List

Results 1 to 8 of 8
  1. #1
    SitePoint Zealot
    Join Date
    Oct 2010
    Posts
    167
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    HTML Object Height

    Hi all,

    I am attempting to place an HTML object on a page but I'm having issues with the height.

    The object varies in height depending on the content, which updates constantly as it is a list of the latest posts on our forum.

    I have set the height as 100% like so:

    Code HTML4Strict:
    <object scroll="no" style="width: 200px; height: 100%;" data="http://ivegotkids.com/community/user/index.php/latest-discussions"> </object>

    But this is giving me a huge gap at the bottom of the object because it's giving me 100% of the screen size, not the actual content.

    How do I set the height to stop at the bottom of the content and not at the bottom of the screen.

  2. #2
    Programming Since 1978 silver trophybronze trophy felgall's Avatar
    Join Date
    Sep 2005
    Location
    Sydney, NSW, Australia
    Posts
    16,789
    Mentioned
    25 Post(s)
    Tagged
    1 Thread(s)
    Have you tried leaving out the height completely?
    Stephen J Chapman

    javascriptexample.net, Book Reviews, follow me on Twitter
    HTML Help, CSS Help, JavaScript Help, PHP/mySQL Help, blog
    <input name="html5" type="text" required pattern="^$">

  3. #3
    SitePoint Zealot
    Join Date
    Oct 2010
    Posts
    167
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Yes, when I do that the frame sets itself a default size which is only a fraction of the size that's needed and I end up with a scroll bar to see the rest of it... I need it to be 100% but it should be 100% of the page size not 100% of the screen size.

  4. #4
    SitePoint Enthusiast AntunTun's Avatar
    Join Date
    Sep 2010
    Posts
    35
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    On which browser you saw this?

  5. #5
    SitePoint Zealot
    Join Date
    Oct 2010
    Posts
    167
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I use Chrome.

  6. #6
    SitePoint Enthusiast AntunTun's Avatar
    Join Date
    Sep 2010
    Posts
    35
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    This is really confusing, height: 100% should stretch it according to content. Can you provide some link so that we can see it live?

  7. #7
    It's all Geek to me silver trophybronze trophy
    ralph.m's Avatar
    Join Date
    Mar 2009
    Location
    Melbourne, AU
    Posts
    24,117
    Mentioned
    448 Post(s)
    Tagged
    8 Thread(s)
    Quote Originally Posted by AntunTun View Post
    This is really confusing, height: 100% should stretch it according to content.
    No, it's based on the element's container, not its content.

    Perhaps JS is needed for this. It would detect the content height and set the height on the object accordingly.
    Facebook | Google+ | Twitter | Web Design Tips | Free Contact Form

    Forum Usage: Tips on posting code samples, images and more

    Forrest Gump: "IE is like a box of chocolates: you never know what you're gonna get."

  8. #8
    Resident curmudgeon bronze trophy gary.turner's Avatar
    Join Date
    Jan 2009
    Location
    Dallas
    Posts
    990
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    It is my experience that object will size itself to its content if possible. Be sure to use the "type" attribute, e.g. type="text/html".

    cheers,

    gary
    Anyone can build a usable website. It takes a graphic
    designer to make it slow, confusing, and painful to use.

    Simple minded html & css demos and tutorials


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •