WindAndWaves said:
This question relates to stylesheets.
Is it possible to say to define the behaviour of classes, elements, etc... within other elements
Yes.
For example of the A-elements within the <DIV CLASS="content">, if so, how do i do that?
div.content a {foo:bar;}
Sorry I am really new to this kind of thing and I do not have a computer background.
The word you are looking for is "selector". A selector in CSS is the
part of a style rule that specifies which elements the properties
deined the in rule apply to. CSS includes a large number of different
selectors that can be combined in many possiblle ways.
The simplest selector is an element selector
div {}
which selects all elements of that type.
A class selector
..foo {}
selects all elements with that class. These can be combined to select
all elements of a given type with that class.
div.foo {}
You're asking about the descendent selector that selects all elements
that descendents of another element. The descendent selector is just a
space.
div p {}
selects all p elements that are descendets of divs.
div.foo p b.bar {}
selects all b elements with a class of bar that are descendents of p
elements that are themselves descendents of div elements with a class
of foo.
See
http://www.w3.org/TR/CSS21/selector.html
But be aware that some browsers (stand up IE) don't support a lot of
the selectors.
http://www.blooberry.com/indexdot/css/syntax/selectors/selectors.htm
isn't fully complete or up to date but does tell you what IE6 does and
doesn't support which is the most important thing to know today.
I have seen stuff around like A > .content {....} is that the kind of thing I should be using?
That's a child selector. It works like a descendent selector but only
applies to immediate children.
<div class="foo">
<p></p>
<div>
<p><p>
</div>
<p></p>
</div>
..foo > p {}
applies to the first and third paragraphs because they are children of
the element with class foo but not to the second because it is a
grandchild.
If so, what should I watch for?
IE doesn't support child selectors. If you write it with spaces then
IE will treat it as a descendent selector. If you write it without
spaces then IE will ignore it.
..foo > p is treated as .foo p
..foo>p is ignored altogether.
Steve