|
|
Post a Project »
Find a Professional HTML Freelancer!
Find a Freelancer to help you with your HTML projects
| |
|
 |
|
|
12-27-2007, 06:07 PM
|
layers versus tables
|
Posts: 11
|
OK, I've had 'nuff. Sorry to be asking this again as I can only imagine how many times it has been asked (and yes, I DID do a search) I need a good and understandable explanation of what tables and layers are, and most important, what is the difference? I've read numerous of tutorials but none has been 100 per cent understandable, and what bothers me is that they all claim different things.
Can someone please explain this to me? Oh and please speak to me as if you would speak to an idiot. Otherwise I won't understand.
EDIT: Wait! Are layers and divs the same thing?
Last edited by Saska; 12-27-2007 at 06:46 PM..
|
|
|
|
12-27-2007, 06:42 PM
|
Re: layers versus tables
|
Posts: 1,712
Name: Jeremy Miller
Location: Las Vegas, NV
|
A table is data arranged in rows and columns. Some goofs use them for layout, but that's not what they're supposed to be used for. Just think of a table like a small part of an Excel spreadsheet displayed on a webpage (without all the fancy features).
I think of layers as figurative transparencies -- you know, those things that are put on overhead projectors in school? If you have multiple layers (i.e. transparency sheets), each with a different thing on them and you lay them on top of each other, then you get a composite of each layer. The layers are still there, but you just can't see them as the layer itself is transparent. When you change one layer, you don't mess with any of the others, so they can be helpful.
In HTML, however, there's nothing named a layer: you make something (e.g. a div, span, iframe, ...) a layer by setting it's position property to absolute or fixed. With absolute positioning the thing you're working on will be put somewhere on a page and kept there. With fixed positioning the thing looks like it's attached to your monitor's screen and not the page -- scroll the page and the doohicky stays right where it was.
So, you ask what the difference is and my response is: just about everything! A table and a layer are completely different entities. Now, you can make a table a layer (as described above), but other than that there is no connection.
Hope this helps!
__________________
Jeremy Miller
Please login or register to view this content. Registration is FREE
Last edited by JeremyMiller; 12-27-2007 at 06:42 PM..
Reason: Wrong form of "they're"
|
|
|
|
12-27-2007, 06:47 PM
|
Re: layers versus tables
|
Posts: 3,621
Name: Thierry
Location: I'm the uber Spaminator !
|
To put it simply, a table is a grid.
You define how many rows and columns it have, and you put your datas in those cells. Imagine an excel sheet, where you define the size.
The layers don't work on a grid, although you can make them behave like a table.
Imagine you take several sheets of transparent papers, and you put your text on them. You can them position them next to each one, in line, in rows, or anywhere you want.
You can even superpose them.
A table have a fixed structure, and your datas must be placed in a cell.
Layers are more free, but their layout adapts less easily to variable width.
To be more precise, you need to know what you're doing for them to work the way you want it. Goes head first, and you'll rip your hairs about positioning problems.
And sometime, when you use precise coordinates (specifying how far from the top left corner you want your layer), they can mess up over each others.
It's the simplest way I can put it...
Edit:
Hey, Jeremy beated me up, but at least we had the same explanation

__________________
Only a biker knows why a dog sticks his head out the window.
|
|
|
|
12-27-2007, 06:52 PM
|
Re: layers versus tables
|
Posts: 11
|
The first and second paragraphs helped a LOT. I kind of do understand (finally) what tables are. I liked the excel and overhead comparision. Now I'll never forget that.
Quote:
|
In HTML, however, there's nothing named a layer: you make something (e.g. a div, span, iframe, ...) a layer by setting it's position property to absolute or fixed.
|
But, are LAYERS and Divs the SAME thing? Or did I get it all wrong? I always thought that layers were short for div layers.
EDIT: tripy, thanks for your responds. It was very helpful!
Last edited by Saska; 12-27-2007 at 06:59 PM..
|
|
|
|
12-27-2007, 06:54 PM
|
Re: layers versus tables
|
Posts: 1,712
Name: Jeremy Miller
Location: Las Vegas, NV
|
No, layers and divs are not the same thing. A div is essentially a box. Go back to the transparency analogy: you could draw multiple boxes on a single transparency, right? In the same fashion you can have multiple divs on a single layer (say, for example, if they were all contained within another div which then had the proper positioning).
__________________
Jeremy Miller
Please login or register to view this content. Registration is FREE
|
|
|
|
12-27-2007, 07:10 PM
|
Re: layers versus tables
|
Posts: 11
|
This confuses me:
LAYERS:
Quote:
|
There is no such thing in the HTML standard. For a brief moment Netscape 4 had a proprietary <layer> tag - but it never went any where. So this is a confusing word introduced by Macromedia for Dreamweaver. I haven't used DW this century, but I believe they use the word "layer" to indicate a div with the possiblity of some javascript - DTHML in other words.
|
|
|
|
|
12-27-2007, 07:40 PM
|
Re: layers versus tables
|
Posts: 3,621
Name: Thierry
Location: I'm the uber Spaminator !
|
Think of a div like a placeholder.
Then, with css, you can make it have a position relative to other elements, or absolute to the top left corner of the screen.
I believe that this is what dreamweaver calls a layer. It's more an acronym for photoshop used peoples than a real HTML entity.
But you can make a div act like a transparent sheet.
And a div acting like a layer can contain several more divs that are not acting like layers.
Look there, there are some visuals examples
http://tutorials.alsacreations.com/div/
http://www.wickham43.supanet.com/tutorial/divboxes.html
http://www.ironspider.ca/adv/cssproperties/position.htm
__________________
Only a biker knows why a dog sticks his head out the window.
|
|
|
|
12-27-2007, 07:42 PM
|
Re: layers versus tables
|
Posts: 1,712
Name: Jeremy Miller
Location: Las Vegas, NV
|
I'm not sure where you got that quote from, but HTML has a standard, i.e. a collection of rules browsers should follow. Now, many browsers follow those rules and then wander off to left field and make their own garbage up thinking that they're so very, very bright and yet ignoring forthcoming standards for some unseemly reason. The <layer> tag was one of those -- they made up their own stuff and it was overwhelmingly rejected.
Now, when you don't code stuff by hand (as I always do), you use an editor. Editors assume you're just plain *** dumb (or else you'd code it yourself, right?) So instead of trying to tell you what things actually are, they give you mental crutches. The example from your quote is DW assuming you're too stupid to understand what a DIV is and how it can be positioned, so instead of telling you to insert a div and set it's positioning, they offer you the mental crutch of a "layer". You create a layer and then DW converts your mental crutch into a div that has been positioned.
If you want to really understand HTML and CSS then study those particular subjects because they are the tools actually used and you will then be able to do more than crutch based tools like DW and your knowledge will be useful beyond DW.
__________________
Jeremy Miller
Please login or register to view this content. Registration is FREE
Last edited by JeremyMiller; 12-27-2007 at 07:44 PM..
Reason: Added context b/c tripy and I are posting over each other :)
|
|
|
|
12-27-2007, 07:48 PM
|
Re: layers versus tables
|
Posts: 238
Location: United States
|
A layer most often refers to a div with absolute positioning.
The origin of the term came with Netscape's short-lived proprietary <layer> element, but it was popularized by both Frontpage's and Dreamweaver's use of the term for a div with absolute positioning.
Both tables and layers are considered poor ways to design layouts. The more accepted method is to use divs, but without absolute position.
|
|
|
|
12-27-2007, 07:55 PM
|
Re: layers versus tables
|
Posts: 1,712
Name: Jeremy Miller
Location: Las Vegas, NV
|
Quote:
Originally Posted by frost
Both tables and layers are considered poor ways to design layouts. The more accepted method is to use divs, but without absolute position.
|
Forgive me, but I have to disagree here. Positioned divs are fine for layouts provided they are positioned relatively (as opposed to assuming everyone's monitor is the same size). Now, many people may use positioned divs incorrectly, but correctly used I see nothing wrong with their use. In fact, it is one of the schemes proposed by the standards: http://www.w3.org/TR/REC-CSS2/visure...tioning-scheme Also, many layouts at http://www.csszengarden.com/ use absolute positioning for some remarkable layouts which also degrade gracefully. Tables, of course, are atrocious for layouts and you'll get no argument from me and you'll find nothing in the standards indicating their use for layouts.
__________________
Jeremy Miller
Please login or register to view this content. Registration is FREE
Last edited by JeremyMiller; 12-27-2007 at 07:56 PM..
|
|
|
|
12-28-2007, 03:54 AM
|
Re: layers versus tables
|
Posts: 42,380
Name: Chris Hirst
Location: Blackpool. UK
|
I have to agree with frost (as most of us do) that absolute positioning should be avoided by anyone just learning CSS/HTML as Saska is.
Absolute positioning is fine once you understand HOW to use it to your advantage.
__________________
Chris. ->> Please login or register to view this content. Registration is FREE <<-
A foolish consistency is the hobgoblin of little minds
Thought for today:- Is SEO the only industry where all the cowboys are Indians?
|
|
|
|
12-28-2007, 03:59 AM
|
Re: layers versus tables
|
Posts: 1,712
Name: Jeremy Miller
Location: Las Vegas, NV
|
Quote:
Originally Posted by chrishirst
Absolute positioning is fine once you understand HOW to use it to your advantage.
|
I agree with this statement.
Re-reading my post I think I need to clarify this statement:
Quote:
|
Positioned divs are fine for layouts provided they are positioned relatively...
|
It seems like I'm confusing absolute and relative. I should have said "positioned using relative units of measurement". Many will position absolutely using pixels as their unit of measurement and that causes a problem. But, positioning absolutely as a % of the available screen width is much more compatible. Then again, one must design the underlying HTML in such a fashion that without the absolute positioning the page degrades well.
__________________
Jeremy Miller
Please login or register to view this content. Registration is FREE
|
|
|
|
12-28-2007, 12:24 PM
|
Re: layers versus tables
|
Posts: 10,017
Location: Tennessee
|
The term 'layers' DOES refer to divs - the 'layers' term is a holdover from the old Netscape days, and unfortunately, Dreamweaver continues to perpetuate it..
You can certainly 'layer' divs to get certain layout effects, but don't refer to them as 'layers'.
__________________
Web Goddess & Web Standards Evangelist :) - Tables Be Gone !!
Please login or register to view this content. Registration is FREE
Please login or register to view this content. Registration is FREE
|
|
|
|
12-28-2007, 12:37 PM
|
Re: layers versus tables
|
Posts: 1,712
Name: Jeremy Miller
Location: Las Vegas, NV
|
Interesting. For more information on layers you may wish to see http://www.w3.org/TR/REC-CSS2/visuren.html#q30 which demonstrates the use of z-index to layer an IMG and DIVs.
__________________
Jeremy Miller
Please login or register to view this content. Registration is FREE
|
|
|
|
|
« Reply to layers versus tables
|
|
|
| Thread Tools |
Search this Thread |
|
|
|
Posting Rules
|
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
HTML code is Off
|
|
|
|