Advanced Search

Results 1 to 5 of 5

Thread: iframe and css

  1. #1
    Join Date
    Jan 2007
    Posts
    6
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Unhappy iframe and css

    i developed an index page, then added an iframe.

    i took out alot of the html from the page when i did so, and created a new file that contains the html i removed from the index page. (which i named index4_home.htm)

    i set this new file as the src="index4_home.htm" value for my iframe src attribute.

    this displays in the iframe, but now all my css is no longer working for all the html within my inframe.

    how do i get my formerly working css to affect the src html of my iframe again?

    i have tried giving an id to my iframe and changing the css to match.

    for instance, before i took out my html from my index page an example of the css was:

    ----------------------------------------
    div.parentContent {
    width:757px;
    height:404px;
    margin:0;
    padding:4px 0 0 0;
    }

    to match my html of <div class="parentContent">
    -----------------------------------------

    after i took out the html and created the index4_home.htm page, i gave an id name to my iframe:
    -----------------------------------------
    <iframe src="index4_home.htm" name="content" id="myiframe2" width="755" marginheight="0" marginwidth="0" height="100%" border="0" frameborder="0" scrolling="no"></iframe>

    and changed my css to match:

    #myiframe2 div.parentContent {
    width:757px;
    height:404px;
    margin:0;
    padding:4px 0 0 0;
    }
    -----------------------------------------

    but no luck.

    im assuming i can embed all my css in the top of the index4_home.htm page, but id rather avoid that and keep my external css file with all its declarations in one place...

    any ideas?

  2. #2
    Join Date
    Jan 2007
    Posts
    6
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    ooops.

    well i just put the <link rel="stylesheet" type="text/css" href="css/style2.css">
    in the head of my new htm file (index4_home.htm) file, and all is good.

    (there are some issues with the background of the page showing through to the iframe now, but at least its reading the styles)

    so yeah, that shoulda been an obvious fix before i posted my issue

    no one read this post.....so i dont get embarrassed

  3. #3
    Join Date
    Jan 2007
    Posts
    6
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    just curious,

    but is it possible to have my iframe's src page read my style declarations from my external css file, without this xtra <link> tag in the head of all my pages that i plan on using as the src of my iframe?

    basically, how do i target a tag in an iframe's scr file?

  4. #4
    Join Date
    Jul 2006
    Location
    just north of Boston, MA
    Posts
    1,806
    Thanks
    13
    Thanked 72 Times in 72 Posts

    Default

    your iframe is essentially a new page, so you can only access the code inside of it by adding the external reference link in the head of that page

  5. #5
    Join Date
    Jan 2007
    Posts
    6
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    txs boogy

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
  •