www.webdeveloper.com
Results 1 to 6 of 6

Thread: fixed position not working in iframe properly

  1. #1
    Join Date
    Jan 2012
    Posts
    34

    fixed position not working in iframe properly

    Ive got an iframe which loads up a page. on that page ive got a <div> which i want to format to fill the entire screen. The iframe does not fill the screen though. From what i read position:fixed; for css is supposed to fix the position to the browser window and not to the container it is in like position:absolute; would. however even though ive got...
    #mydiv {
    position:fixed;
    top:0px;
    bottom:0px;
    left:0px;
    right:0px;
    }


    the div only fills the iframe not the whole browser window

  2. #2
    Join Date
    Feb 2011
    Posts
    231
    Hy,
    Try add:
    width:100%;
    height:100%;

    Not sure if it works, but is an ideea .

  3. #3
    Join Date
    Jan 2012
    Posts
    34
    no its the same thing. it seems it doesnt want to respect the browser window and only wants to respect the iframe window

  4. #4
    Join Date
    Feb 2008
    Location
    NW Washington State
    Posts
    1,856
    Post a link to the page. The css for only one element is just part of the story.
    Is the iframe inside mydiv? and you want mydiv in a fixed position 0,0 top left? and you want mydiv to will entire window? ... but iframe contents may not be large enough to so that.
    Anyway, post a link and describe again what you are attempting, then we will be better able to visualize and assist.
    Best wishes,
    Eye for Video

  5. #5
    Join Date
    Mar 2011
    Posts
    1,141
    If #myDiv resides in the document that is displayed by your <iframe> tag, then it's position will be calculated in reference to the <iframe> (or, more precisely, the document displayed in the <iframe>), not the parent document. So position the <iframe> tag itself.
    Rick Trethewey
    Rainbo Design

  6. #6
    Join Date
    Jan 2012
    Posts
    34
    rtrethewey has it right. the DIV is in the document thats opened inside the iframe. i thought absolute positioning was supposed to be relative to the container and fixed was to the browser.

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

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



Recent Articles