Skip to main content
gamedev.net
🔒 Locked

Web programming questions #3 - frames Vs CSS-P

Started by d000hg 14 replies 700+ views
Original Post
d000hg
d000hg
I''ve heard a couple of times that frames are viewed as a bad way of doing things these days. CSS-P(ositioning) is the only alternative I know of, but first is it actually frowned upon to use frames or not? If so can someone suggest a good reference/tut for CSS-P for someone already knowing CSS? The reservation I have against not using frmes is this: Suppose you have a set of 10 linked pages, all very simple. You want a navigation bar too. With frames you write the simple pages quickly and one navbar page. Without frames, do you not have to cut''n''paste it''s code into every page in the sequence? I''m presuming if frames are not in vogue that there is a way round this?
d000hg
d000hg
Hmm, I''ve found a couple of problems with frames:
look here The navbar frame gets stretched by the banner ad so it scrolls even when it shouldn''t need to. In addition the main page loads the navbar each time it changes to show which is the active page but they don''t change together and it''s horrible! Is the latter a frames problem or a ''my sucky javascript'' problem though?
llyod
llyod
Do you use server side scripting? (PHP) ?

In which case you''ll simply include() the navigation bar into the current page.

Definitely learn CSS, it''s invaluable for styling your pages.

You can cheat by doing layout with a simple table, which is styled using CSS.

Proper layout in CSS that works on all browsers can''t be learned in a day, it''s hard.


Using frames makes it hard to bookmark your site. You don''t want that, do you?
Damocles
Damocles
You could use tables - then in the navbar cell you would use an iframe to load the navbar page. Quick and easy.
------------------------------------------[New Delta Games] | [Sliders]
d000hg
d000hg
Ah yes, tables. If I had a 1 row, 2 column table with the navbar on the left and the main page on the right, can I get the left cell not to scroll as with frames so it''s always at the top of the page? Or do I need to use <div>?
twanvl
twanvl
I would recommend that you don't use tables for layout, css is so much easier once you get the hang of it:

#nav{
position:absolute;
left: 0;
top: 0;
width: 12em;
}
#main {
left: 0;
top: 0;
margin-left: 12em;
height: 100%;
width: 100%;
overflow: scroll;
}

Frames have some disadvantages like being hard to bookmark, if you don't have to use them you probably shouldn't

[edited by - twanvl on March 6, 2004 9:41:51 AM]
d000hg
d000hg
look here If you see what I'm doing when the main page is too long to fit, it scrolls vertically but the navbar doesn't. This is something very important to me. Can it be done without using frames, I've looked at div and absolute positioning but they don't seem to help? Unless I took away the page scrollbar and let the main div section have one, but that's real ugly!



[edited by - d000hg on March 6, 2004 10:01:41 AM]
d000hg
d000hg
Grrr, I''m sure I saw an example of what I want in CSS a couple of days ago but no idea where. It had a stationary navbar and scrolling main window like I want. Kind of urgent, if anyone knows of an example or how I can achieve this...

(oh and I''m tinkering with my site so don''t be surprised if it does vry bizarre things!)
d000hg
d000hg
Anyone?
d000hg
d000hg
Not really - isn''t using iframes just as ''bad'' as normal frames? I was intrigued how you got the green curvy border and green scroll bar when your source doesn''t seem to utilise any CSS headers or inline sytles.
Alimonster
Alimonster
You can use position:fixed to get the navbar staying on screen like a frame. Unfortunately this doesn''t work right in IE (what a shock), but the other browsers do it. I''ve been tempted to just tell IE users to get a clue, but I think it may be a better idea to use server-side script to spit out a frame for IE users and CSS for competent browsers.
d000hg
d000hg
The effect I want is exactly as can be found on my site - go to a page which is too long for the main frame and see how when you scroll down, the navbar stays at the top of the page. What I''m looking for is to do this without frames.
Alimonster:
It sounds like that''s what I want but if it''s not supported...
Are you talking about dynamically generating css files depending on the browser or just making a switch between frames+fileA.css or noframes+fileB.css - I''ve been wondering if you can use ASP/PHP to generate css files on the server at all.

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.