What is the difference between a layer and a cell?

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I am new to all of this and am just trying to understand the terminology. I
understand the cell as part of a layout table. But, what is a layer? It
seems to be the same thing.
 
To understand the answer to questions like this, you will need to know some
HTML. This is a good thing.

There is no formal definition of 'layer'. Each HTML authoring system seems
to apply a slightly different spin to it, but for sure one thing is common
to them all - layers are positioned elements (as opposed to those that are
just placed on the page based on where they appear in the code).

Generally, a layer is a container element - this could be a <div> tag, a <p>
tag, an <h1> tag, a <span> tag, or any tag that can contain other page
elements. In addition it's a container element that is positioned. For
example, this is a layer by anybody's definition -

<div style="position:absolute; top:50px; left:25px; z-index:99;">This text
is placed 50px from the top margin and 25px from the left margin</div>

A table cell is what is formed by and opening <td> (for table data) and a
closing </td> tag, e.g.,

<table>
<tr>
<td>this is a table cell</td>
</tr>
</table>

Table cells can not be positioned in the usual sense of the word
"positioned", since they are constained to be within the table itself.

So - let me summarize. For you, right now, consider this your marching
orders - straight from Tonto:

Tables - good. Layers - bad.

Don't use layers until you understand how CSS positioning works, and how to
use it to your benefit.
 
Yes. That's succinct. Perhaps better (but more voluminous):

A layer is not what most people (who use them without understanding
positioning) wish it was.
 
Thanks. I have bought a book on Front page. Your answer was helpful. The
book is a big help. Have a happy day.

Bob
 
A cell represents a "block" element with x and y dimensions.
A layer adds the third dimension, "z", regardless of the HTML
authoring system. At least that's the way I see it. If some
company out there decides to create a new definition for layer,
then their definition only applies to their product, and the rest
of the world sees a layer as the 'z' dimension/order.

A table is a cell which contains "cells" but a "cell" sometimes
represents any type of "block" element. A table and a cell
both are "block" elements, both containing x and y
dimensions. But, if there's block, there's something else...

With "block" elements, there also exists "inline" elements. You
typically employ "block" elements to position and contain
"inline" elements. An inline element flows from "left to right"
and "top to bottom" and one property of the inline element
equates to the line-height. Basically, it's easier to think of inline
elements as lines of text or specific areas of text inside a paragraph
of text. They typically wrap around or flow around block elements.

To understand HTML, think of a printing press where you
blocks of images and ads on the page and place blocks of
lines of text around the images. Some important things to
remember include...

1) <div> represents the "block" style of the "inline" <span> tag.
2) <p> represents a "block" element to hold paragraphs of text.
3) <a>, <b>, <strong>, <i> are all "inline" tags and applied to
both text elements and block elements.

Hope this helps.

Did I miss something in my HTML fundamentals? Is there another
definition for layer?

Jim Carlock
Post replies to the newsgroup.

P.S. Some of the left-to-right nonsense and top-to-down gibber
might flow right-to-left or left-to-right after top-to-bottom, for
languages other than English.
 
Jim said:
Did I miss something in my HTML fundamentals? Is there another
definition for layer?

Murray wrote a great definition of layers not long ago.
Here is his post in full:

==============================
Here's a post I have repeated (and updated) more than once here about layers
and tables -
you may find it helpful -

If you need to use layers, then use them. If you want to begin using
CSS-P
methods, then use them by all means! But learn how to use them first

http://www.thepattysite.com/layer_laws.cfm

The word "layer" was first coined by Netscape when it introduced its
heinous
and ill-fated <layer> tag with NN4x. It has since been adopted by th
community to generally refer to absolutely positioned <div> tags, and
Dreamweaver has
propagated that usage. In fact, there is really no such HTML thing a
layer, but for the purposes of this discussion let's use the
Dreamweaver/FP
sense of applying that term to absolutely positioned <div>s.

==============================
In plain talk, a layer is like a magic carpet - it floats above your
content (any page content, including tables, images, text, etc.). It
unaffected by page margin settings because it is not really on the pa
You can whisk it around on the page to provide motion (using timeline
You can make it visible or invisible using any of the actions appropr
to
your browser selection (like onMouseOver, onClick, onLoad, etc.). Yo
dynamically clip or scroll the contents of layers to provide a window
effect within a page. Layers are wondrous constructs that let you br
your pages to life! Get to know them - they are your friends....
=================

I would add in clarification and elaboration that layers are position
elements and as such allow you to put content at any location you des
regardless of the remainder of the content on the page.

The downside to layers is the flip-side of their real benefit. Becau
they
are absolutely positioned, they will be static page elements, i.e., t
will not move to reflect changes in your browser viewport size unless
you
apply some custom javascript to the page that makes the layers move,
unless you use
specific CSS-P techniques to make them move. There
is no native support in HTML for moving layers - that's why it must b
done
with custom js or advanced CSS.

If you consider that a 'layer' is really just a 'division' or <div> t
the page, and that you can use
CSS to position this <div> tag, as well as control the format of its
contents and how it interacts with
other content around it, then you can see how valuable it might be fo
as a page layout tool!
This impression is certainly true. As you become more familiar with
you will learn how to
replace a large part of your current page layout methodology with pur
positioned page
elements. But it's something you should take your time with. It is t
way of the future, so at
some point we will all have to come to grips with using CSS in this
manner.

Some people use layers exclusively for page layout because of the eas
with
which they can be positioned. I do not recommend this approach for a
that is new to layers or to CSS in general because it can be confusin
troublesome. This is partucularly the case if you will have multiple
layers, each
containing nominally uncontrolled/unstyled text. Viewers resizing th
text in their
browsers will see a disappointing overlap of paragraphs that is surel
what you desire.

Tables, on the other hand, are most everything that layers are not!
are flexible page elements, in that native HTML can center, or right
left
align a table - in other words, they can float around on your page
depending
on the browser's viewport width. Although originally added to HTML a
means of displaying tabular data only, tables quickly became the
principal
structural element used in page layout. They can be made rigid in or
to
provide a stable base for your page elements, including text, images,
Flash,
etc. They are easy to use and to learn (more or less), and behave in
(mostly) predictable ways across browser and platform combinations -
there are quirks that must be learned to use them successfully. Luck
most of these quirks are discussed here daily. In spite of these qui
however, if you intend
to be a credible web developer, you must learn how to build stable ta
with
your hands behind your back!

So - to summarize...

If you want motion on your page, you must use layers. If you want be
for your page layout, you must use tables at this point. Or not
(particularly when you
consider what you can do with CSS positioned page elements and NO tab
at
all - http://www.csszengarden.com).

Bear in mind that advanced use of these two page elements can
significantly blur these two criteria.

And remember, the use of one does not preclude the use of the other o
same page.
Use them both if the spirit moves you.

There you go....
 
Yes. Exactly. Except for wish it were for the correct subjunctive mood
-- I knew you would care :=)
 
Clark said:
Yes. Exactly. Except for wish it were for the correct subjunctive mood
-- I knew you would care :=)

Great.
I wonder how many people (including the esteemed Murray) would know about
the subjunctive mood.

Probably not anyone in the younger generation, say less than 30 years old.
:-))
 
I do. And I should have used it. I wish it were true.

I also know about the past pluperfect tense.

I know some smoke.... 8)
 
Back
Top