I'm trying to learn CSS2, find some aspects of it quite confusing..
here, http://www.w3.org/TR/REC-CSS2/selector.html#q1 I see this:
E F : Matches any F element that is a descendant of an E element.
Descendant selectors
E > F : Matches any F element that is a child of an element
E. Child selectors
please, what is difference between a descendant and a child element..
thank you. 4 1918
maya wrote: I'm trying to learn CSS2, find some aspects of it quite confusing..
here, http://www.w3.org/TR/REC-CSS2/selector.html#q1 I see this:
E F : Matches any F element that is a descendant of an E element. Descendant selectors E > F : Matches any F element that is a child of an element E. Child selectors
please, what is difference between a descendant and a child element..
thank you.
Your child is your child. Your descendant can be your child, your
grandchild, your great-grandchild, etc.
Harlan Messinger wrote: maya wrote:
I'm trying to learn CSS2, find some aspects of it quite confusing..
here, http://www.w3.org/TR/REC-CSS2/selector.html#q1 I see this:
E F : Matches any F element that is a descendant of an E element. Descendant selectors E > F : Matches any F element that is a child of an element E. Child selectors
please, what is difference between a descendant and a child element..
thank you.
Your child is your child. Your descendant can be your child, your grandchild, your great-grandchild, etc.
ok, thank you very much.. I had thought maybe they were different
relationships..
maya wrote: Harlan Messinger wrote:
maya wrote:
I'm trying to learn CSS2, find some aspects of it quite confusing..
here, http://www.w3.org/TR/REC-CSS2/selector.html#q1 I see this:
E F : Matches any F element that is a descendant of an E element. Descendant selectors E > F : Matches any F element that is a child of an element E. Child selectors
please, what is difference between a descendant and a child element..
thank you.
Your child is your child. Your descendant can be your child, your grandchild, your great-grandchild, etc.
ok, thank you very much.. I had thought maybe they were different relationships..
Umm - you're not paying attention. They ARE different relationships.
A child is a descendant, yes. But although a descendant can be a child,
a descendant can also be a grandchild, etc.
To put it back in CSS terms - (using your case above) assume the style:
div.E div.F { background-color: red; }
If you have:
<div class="E"> (filler)
<div class="whatever "> (filler)
<div class="F">Stuff here</div>
</div>
</div>
<div class="E"> (filler)
<div class="F">Stuff here</div>
</div>
both class "F" divs would have a red background.
BUT if you defined the style as:
div.E > div.F { background-color: red; }
ONLY the second one would have a red background - since the first one is
a descendant, but NOT a CHILD of "E".
--
"The most convoluted explanation that fits all the available and made-up
facts is the most likely to be believed by conspiracy theorists"
Tony <to****@dslextr eme.WHATISTHIS. com> scripsit: A child is a descendant, yes. But although a descendant can be a child, a descendant can also be a grandchild, etc.
These metaphoric names - which derive from the common information technology
jargon - are rather unfortunate. A father or a mother does not contain their
children and other descendants.
We cannot change these misleading terms, but it helps to translate them
(mentally and in teaching) to more suitable expressions. A "child" is a
(direct) subelement, whereas a "descendant " is an indirect subelement, i.e.
a subelement or a subelement of a subelement etc. There is nothing
comparable to begetting a child or giving birth to a child or raising a
child. ("Inheritanc e" - probably the most often and most seriously
misunderstood basic concept of CSS - means that a subelement copies a
property value from its enclosing element if does not get a value for the
property from any style sheet directly. So the word "inherit" is hardly a
good metaphor either.)
To put it back in CSS terms - (using your case above) assume the style: div.E div.F { background-color: red; }
That's a bad example; setting background-color without setting color (or
background-image) is bad practice. It's common practice, and therefore it's
particularly bad style in an example. It's not "just an example". People
learn by example. If your text contradicts with your examples, people
understand, believe, and remember the examples and ignore the texts. With a
bit exaggeration (well, maybe a little more than a bit), one can say that in
explaining matters like CSS, or markup, or programming, examples are the
real thing, and the text is there just to fill the pages and perhaps to be
consulted if an example is not quite crystal clear.
both class "F" divs would have a red background.
Assuming that no other style sheets are involved, that is.
BUT if you defined the style as: div.E > div.F { background-color: red; }
ONLY the second one would have a red background - since the first one is a descendant, but NOT a CHILD of "E".
Wouldn't it be simpler to say just that
..E .F matches any class "F" element that is directly or indirectly a
subelement of a class "E" element, whereas
..E > .F matches any class "F" element that is a direct subelement of a class
"E" element?
I'm afraid it needs to be mentioned that direct subelement selectors like .E .F are generally not useful in CSS authoring for the WWW at present or in
the near future, since they are not supported by IE 6. Of course, if you are
prepared to having anything applied to such a selector ignored in most
browsing situations, then it's just fine.
--
Jukka K. Korpela ("Yucca") http://www.cs.tut.fi/~jkorpela/ This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: Neil Zanella |
last post by:
Hello,
I would like to know what the major enhancements of CSS2 over CSS1 are and
whether CSS2 support is any better these days than it was a few years ago.
In particular, do most browsers fully support CSS1 nowadays? What about
CSS2? I like the idea of CSS, and prefer XHTML syntax to HTML 4.01
because I can use the class attribute to define style, instead
of having a bunch of markup junk everywhere. Now I want to
get the most of out of...
|
by: Michael Winter |
last post by:
Is it possible to test for CSS level 2 support, preferably using just
CSS2? For example, the following could alert the user that their
browser doesn't support CSS1 or 2. Is there an equivalent for level 2
only?
Many thanks,
Mike
|
by: Patrick |
last post by:
Hi
I am a newbie struggling a little with css.It is hard to get it right
in all browsers, so i decided to read the CSS2 specification on the w3
site.
What is the following from the CSS2 specification:
"Quote starts":
5.6 Child selectors
|
by: Karl Smith |
last post by:
I heard a rumour that Opera succeeded where none have before, and
implemented the tables described in HTML4 and CSS2. So I thought I'd
try it out with the well known Periodic Table.
http://users.tpg.com.au/karl6740/css/table_elements_periodic.html
CSS:
Notice in the TRs with the lanthanides and actinides, the empty TDs at
the end taking the background colour of the TR? I say they shouldn't
|
by: Michael Bulatovich |
last post by:
Has anyone got a good link to a concise discussion of where things now stand
regarding these two?
e.g.
What browsers are compliant with one or the other?
What the adoption rate is of these browsers?
How are site developers dealing with what appears to me to be the
| |
by: Jan Roland Eriksson |
last post by:
The following URL...
<http://www.w3.org/TR/CSS21/>
....has had the following text in it for a considerable time now.
"This is a W3C Candidate Recommendation, which means
the specification has been widely reviewed and W3C
recommends that it be implemented. It will remain Candidate
Recommendation at least until 1 September 2004."
|
by: Xah Lee |
last post by:
what's new in CSS2?
http://xahlee.org/js/css2.html
Xah
xah@xahlee.org
∑ http://xahlee.org/
|
by: David E. Ross |
last post by:
A new working draft of the CSS2.1 specification was published on-line on
11 April. Does anyone know what changed since the previous (13 June
2005) working draft?
--
David E. Ross
<http://www.rossde.com/>
Concerned about someone (e.g., Pres. Bush) snooping
|
by: Steven Nagy |
last post by:
So I was needing some extra power from my enums and implemented the
typesafe enum pattern.
And it got me to thinking... why should I EVER use standard enums?
There's now a nice little code snippet that I wrote today that gives me
an instant implementation of the pattern. I could easily just always
use such an implementation instead of a standard enum, so I wanted to
know what you experts all thought.
Is there a case for standard enums?
|
by: Jean Pierre Daviau |
last post by:
Hi,
I am looking for a pdf version of CSS2.1 Specification
Thanks
--
Jean Pierre Daviau
|
by: Hystou |
last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it.
First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
| |
by: jinu1996 |
last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth.
The Art of Business Website Design
Your website is...
|
by: Hystou |
last post by:
Overview:
Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
|
by: tracyyun |
last post by:
Dear forum friends,
With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
|
by: agi2029 |
last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own....
Now, this would greatly impact the work of software developers. The idea...
|
by: TSSRALBI |
last post by:
Hello
I'm a network technician in training and I need your help.
I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs.
The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols.
I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
|
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
| |
by: 6302768590 |
last post by:
Hai team
i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
|
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
| |