Grow your CSS skills. Land your dream job.

iframe x,y positioning?

  • # June 7, 2012 at 3:04 pm

    Is there a way to get an iframe to adhere to a set of x,y coordinates?

    I’m trying this on this page and it does not seem to be working..
    http://www.mollymorkoski.com/?page_id=9

    # June 7, 2012 at 3:33 pm

    Select your code and then press the little button with the blue brackets and white paper.

    Anyhoo, you might want to put this part in the BODY tag, not the IFRAME tag:

    onload="window.frames.scrollTo(300,300)"
    # June 7, 2012 at 3:45 pm

    OK, here is the full code…this is a wordpress page…so how would that work?

    # June 8, 2012 at 12:37 am

    In the last situation I had to do this, I used CSS to accomplish it. It looked kind of like this:


    #outerdiv {
    width: 500px; position: relative;
    }
    #innerdiv {
    position: absolute; left: -320px; top: -220px;
    overflow:hidden;
    }






    Managed to do the job, but I don’t know if it’s “correct” in terms of design practice lol.

    # June 8, 2012 at 9:59 am

    Thanks, but this was moving the entire div over, rather than moving the embedded frame within the inner div???

    # June 8, 2012 at 1:07 pm

    Ok I see – I missed a step there (had to look it back up :P) – assign the id to the iframe itself:

    # June 8, 2012 at 2:34 pm

    hmmm… still not working? It keeps on moving the div/frame, not the page within the div/frame.

    # June 9, 2012 at 5:12 pm

    Check this out here: http://jsfiddle.net/xDU9V/

    does that help at all? If you adjust the negative values of the “innerdiv” you’ll see the content inside the window move around.

    # June 10, 2012 at 8:18 pm

    AHHHH!! SUCCESS!! THANK YOU!!

    # June 12, 2012 at 3:02 pm

    Sweet! Glad it helped!

Viewing 10 posts - 1 through 10 (of 10 total)

You must be logged in to reply to this topic.

*May or may not contain any actual "CSS" or "Tricks".