Results 1 to 3 of 3

Thread: Styling content within Iframe

  1. #1
    Join Date
    Sep 2008
    Posts
    77
    Thanks
    4
    Thanked 0 Times in 0 Posts

    Default Styling content within Iframe

    Is there any way for me to style content within an iframe by doing something to the iframe code or is the only way to do it is to style the content within and then load it in the iframe?

    I am trying to center and change the height of an image being display within my iframe, but problem is I want to display around 100 no way I can create a page with the style for each and everyone of them....

    Thanks,
    John

  2. #2
    Join Date
    Mar 2007
    Location
    Currently: New York/Philadelphia
    Posts
    2,735
    Thanks
    3
    Thanked 519 Times in 507 Posts

    Default

    No, you can't control the styling of anything loaded within an iframe from outside of it. You might want to rethink how you're loading the images within the iframe.

    A little php would make this fairly easy. If all that you're doing within the iframe is loading an image, you might try something like this:


    PHP Code:
    <?php
    $img 
    $_GET['img']
    ?>
    <img src="path/<?php echo $img?>" alt="image">
    Then, you could just add CSS styling to that one page. You would call different images as such: image.php?img=filename.jpg

    This is fairly basic. You might want to make a little more robust for real application. But, nonetheless, it does what you need without having to create 100 different pages.

  3. The Following User Says Thank You to Medyman For This Useful Post:

    ponyghost (12-06-2008)

  4. #3
    Join Date
    Dec 2008
    Posts
    1
    Thanks
    1
    Thanked 0 Times in 0 Posts

    Default scrollbar

    i tried the code you posted, and it works well. i am now wondering how to maintain scrollbar postition? i like the iframe because if you have a div on the left with nav, and say a content div in the middle, the scrollbar stays in the same place. the drawback is that the URL is the same for every image. i'd like people to be able to copy the URL ...but i'd also like the scrollbar not to reset after each image is retrieved. is there any way to do this?

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
  •