1. Advertising
    y u no do it?

    Advertising (learn more)

    Advertise virtually anything here, with CPM banner ads, CPM email ads and CPC contextual links. You can target relevant areas of the site and show ads based on geographical location of the user if you wish.

    Starts at just $1 per CPM or $0.10 per CPC.

How Come This <Object> Won't Size Automatically?

Discussion in 'CSS' started by Captain_Ambiguous, Sep 14, 2017.

  1. #1
    I'm working on a landing page for the network of sites I'm pulling together. Decided to make the landing page a forum, just for extra content and engagement. So I've installed a Simple Machines forum, viewable here: http://stephenbrennan.ca/badmanfusion/index.php
    SEMrush
    To get the landing page functionality I was looking for, I added an object tag in the SMF theme file that pulls from a small external HTML file. The tag is set up as follows:

    <object type="text/html" style="width: 100%; height: 820px;" data="http://stephenbrennan.ca/BadManFusionLanding.htm"></object>​

    The code of the external file is pretty basic thus far:

    <style type="text/css">
    
    #landingHeader {
    
        width: 100%;
        height: 100%;         
    }
    
    #landingHeaderImage {
        max-width: 100%;
        height: auto;
        margin: auto;
        display: block;
    }
    
    </style>
    
    <div id="landingHeader">
                    <img alt="" id="landingHeaderImage" src="Link_Header.jpg" width="1200" height="675">
                 
    </div>
    Code (markup):
    The header image resizes itself automatically. But I found that if I don't set the object tag height (820px) the object area crops itself to like 1/3 of the image height. Tried setting the height to 100% or auto but it doesn't seem to make a difference.

    I'd be content to leave the height manually set, but when I view the page in a minimized browser, or on my phone, that 820px results in a large white gap between the image and the forum block. Anyone know why the object tag insists on eating itself?
     
    Last edited by a moderator: Sep 14, 2017
    Captain_Ambiguous, Sep 14, 2017 IP
    SEMrush
  2. denis bayly

    denis bayly Member

    Messages:
    54
    Likes Received:
    14
    Best Answers:
    5
    Trophy Points:
    35
    #2
    Hi there Captain_Ambiguo,

    why don't you do away with the "object element" altogether
    and just use the "img element" in it's stead?

    This CSS...
    
    
    #landingHeaderImage {
        width: 98.6%;
        height: auto;
        margin: 0.6em auto;
        display: block;
     }
    
    
    Code (markup):
    ...would suffice. :D

    coothead
     
    denis bayly, Sep 15, 2017 IP
  3. Captain_Ambiguous

    Captain_Ambiguous Member

    Messages:
    66
    Likes Received:
    1
    Best Answers:
    0
    Trophy Points:
    45
    #3
    I could, but I'll likely be adding a few more elements to the header....actually maybe I can just paste the whole div in there and ditch the object as you suggest. I'll give that a shot. I don't really like php.
     
    Captain_Ambiguous, Sep 15, 2017 IP
  4. deathshadow

    deathshadow Acclaimed Member

    Messages:
    8,501
    Likes Received:
    1,515
    Best Answers:
    223
    Trophy Points:
    515
    #4
    uhm... because objects and iframes don't size automatically?

    NOT that you should be using either... though really that MASSIVE space wasting image you seem to be slopping in isn't going to win any friends amongst visitors to a FORUMS. Sucking down an entire screen full of NOTHING shoving the CONTENT -- aka the part people are actually coming to your forums far -- COMPLETELY off the bottom of the screen even at 1080p?

    Way to make sure NOBODY wants to use your forums!
     
    deathshadow, Sep 18, 2017 IP
  5. Captain_Ambiguous

    Captain_Ambiguous Member

    Messages:
    66
    Likes Received:
    1
    Best Answers:
    0
    Trophy Points:
    45
    #5
    .....landing page......
     
    Captain_Ambiguous, Sep 18, 2017 IP
  6. deathshadow

    deathshadow Acclaimed Member

    Messages:
    8,501
    Likes Received:
    1,515
    Best Answers:
    223
    Trophy Points:
    515
    #6
    In other words a splash page, something we've been told for TWENTY DAMNED YEARS to stop doing! It only pisses off visitors. Put a cute little logo in the corner and use the rest of the screen FIRST damned time they get to your site for the CONTENT!!!

    Anything else is artsy-fartsy bull that is GUARANTEED to make you /fail/ -- no matter how many marketing types and "artists" under the DELUSION that they know the first thing about design might cream their panties over it. That stuff stopped impressing people or drawing audiences almost as soon as it was introduced DECADES ago and that it's slowly creeping back into sites is NOT a good thing.

    People do not visit a forums for some artsy fartsy nonsensical image garbage -- they visit for the CONTENT, so your job in building a site is to get that content to them as quickly and cleanly as possible. Anything else is artsy-fartsy hoodoo-voodoo flash-over-substance bullcookies!
     
    deathshadow, Sep 18, 2017 IP