Page 1 of 2 12 LastLast
Results 1 to 10 of 13

Thread: Basic HTML question

  1. #1
    anewguy is offline I Ubuntu, Therefore, I Am
    Join Date
    Jun 2007
    Location
    Sometimes I visit earth
    Beans
    5,435
    Distro
    Ubuntu 12.04 Precise Pangolin

    Wink Basic HTML question

    I don't know if I'm in the correct forum or not, but it was the closest thing I could find for the question.

    I have noticed that if I use frames on a web page, specifying percentages of the screen for the size, that the pages don't "auto-size" depending on the resolution. If I build a page that looks good in 800x600, going to something larger keeps the page the same size with white space around it.

    Is there some way with frames to make it auto-size?

    Thanks in advance!

    Dave

  2. #2
    Join Date
    Nov 2005
    Location
    Leeds, UK
    Beans
    1,634
    Distro
    Ubuntu Development Release

    Re: Basic HTML question

    I ended up writing some js to do that. Something like this should do the trick:
    Code:
    <script type="text/javascript" >
    document.body.onresize=function() {
    document.getElementById('id_of_iframe').style.width="20%";
    }
    </script>

  3. #3
    Join Date
    Nov 2005
    Location
    Leeds, UK
    Beans
    1,634
    Distro
    Ubuntu Development Release

    Re: Basic HTML question

    Make that "window.onresize". It seems to work in more browsers.

  4. #4
    Join Date
    Jun 2006
    Beans
    Hidden!

    Re: Basic HTML question

    Do not use frames.

    I repeat: do not use frames.

    I don't know what you're trying to do, but I do know that you don't need frames for it. iframes are okay, just not the regular 1998 geocities html3 atrocities that some of us can't scrape from our memories.

    I realize this doesn't answer the question you asked, but if you had asked "Is this a good technique for tripping random strangers in busy crosswalks?" I'd have probably diverted the question similarly.

  5. #5
    Join Date
    Feb 2009
    Beans
    789
    Distro
    Ubuntu 10.04 Lucid Lynx

    Re: Basic HTML question

    Quote Originally Posted by teryret View Post
    Do not use frames.

    I repeat: do not use frames.

    I don't know what you're trying to do, but I do know that you don't need frames for it. iframes are okay, just not the regular 1998 geocities html3 atrocities that some of us can't scrape from our memories.

    I realize this doesn't answer the question you asked, but if you had asked "Is this a good technique for tripping random strangers in busy crosswalks?" I'd have probably diverted the question similarly.
    +1. Whatever you do, get rid of the frames. They're on the way out.

  6. #6
    Join Date
    Apr 2007
    Location
    (X,Y,Z) = (0,0,0)
    Beans
    3,715

    Re: Basic HTML question

    There's a nice alternative that might give you a really classy look: playing with fixed position divs and depths. The idea is similar to the "layers" approach you use in photo manipulation software: you construct a div for each "frame", plus the div for your text area (which should not be fixed so it scrolls). The effect will be that the fixed divs will eventually be above the text when scrolling, thus simulating a frame.

  7. #7
    Join Date
    Jul 2010
    Beans
    2

    Re: Basic HTML question

    try to design your tables and divs with percentage instead of pixel.
    for example u can use <div style="width: 100%">your content</div>

  8. #8
    anewguy is offline I Ubuntu, Therefore, I Am
    Join Date
    Jun 2007
    Location
    Sometimes I visit earth
    Beans
    5,435
    Distro
    Ubuntu 12.04 Precise Pangolin

    Wink Re: Basic HTML question

    Everything was done with frames because it worked. All frames were desribed as percentages of the screen.

    I think I had things reversed in my original post though, so I should explain:

    • a small top section of the screen is devoted to a menu that remains the same for every page
    • a section of the left side of the screen is devoted to information that doesn't change
    • the larger frame in the rest of the screen is what changes from page to page. So, it easy to define links with target= to that frame and avoid all kinds of duplicate html per page and there is no need to reload the menu and left sections for each "page".


    I'm no expert at any of this - this is what I knew how to do from the past. The biggest problem is that there is text and on-mouse-over images in the top menu, so when you go from one screen size (in this case 1024x780) to a smaller resolution (800x600), you end up with scroll bars in the menu and the left portion of the screen. Building the text and mouse-over images for 800x600 then results in white space when going to a higher resolution.

    So, if there is some way to not use frames, but still maintain only 1 definition of the menu and left side (and consequently only 1 loading as everything else goes to the "main" frame), have pages that work in multiple resolutions without adding scroll bars or white space, then that's what I need.

    Please, while I appreciate your wisdom, don't condemn me for using the only thing I knew to make something work - and it does work as intended. The multiple resolution support is what is messing things up.

    Dave

  9. #9
    Join Date
    Jun 2006
    Beans
    Hidden!

    Re: Basic HTML question

    If I were you I'd look at using jQuery to AJAX in the main body and then replace the current one with that. Even if you've never written a line of javascript before, it's so easy to do with jQuery there's really no reason not to.

    For example, if you're doing a good layout you're going to have plenty of divs, and for the sake of the example one of them will have id="gladImNotAFrame", and further that the page you want the contents of is called newPage.html. The jQuery to do the AJAXing for you is:

    Code:
    $("#navButton").click(function (){
        $.ajax({
           url: "http://www.example.com/newPage.html",
           data: {},  //if you need to pass get args to newpage this is how you do it
           success: function(data){
              $("#gladImNotAFrame").html($(data).find("#gladImNotAFrame").html());
           },
           dataType: "html"
        });
    }
    As for having one definition of the top bar etc look at either PHP, ASP.NET, or SHTML (http://en.wikipedia.org/wiki/Shtml).

    Getting nice nav is a tricky business, but the way I prefer is to have an image with no text that is much much wider than you need, then set that as the background image of a li, fill the li with the text of the button and a div that has the very thin image for the other side of the tab. The result is buttons that resize automatically as the text size changes, look good from an SEO perspective, and work in every browser (even the lamentable ones). I realize this is pretty high level, but I don't know exactly what you're trying to do so I'm covering bases.
    Last edited by teryret; August 20th, 2010 at 03:54 AM. Reason: example

  10. #10
    Join Date
    Sep 2007
    Location
    Christchurch, New Zealand
    Beans
    1,328
    Distro
    Ubuntu

    Re: Basic HTML question

    Quote Originally Posted by anewguy View Post
    ...
    So, if there is some way to not use frames, but still maintain only 1 definition of the menu and left side (and consequently only 1 loading as everything else goes to the "main" frame), have pages that work in multiple resolutions without adding scroll bars or white space, then that's what I need.
    Yes, I would like to know about that too, cuz I've seen people use lots of fancy css to get the same effect, but what I hate about their solution is the way every single page on the site duplicates all their navigation links!

    Whenever they want to change something like adding a link they have to go edit all of their pages. While much maligned by puritans, frames do let you have just one single site navigation .htm that you bung in one of the frames for the whole site.

    Never throw out dirty bath water when the baby is still in the bath

Page 1 of 2 12 LastLast

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
  •