473,396 Members | 1,770 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

Inconsistent application of child selection operator

At http://www.gavelcade.com/tests/parti...cognition.html is an
illustration of an apparent inconsistency in the way the child selection
operator > is handled with respect to tables, rows, and cells. I'm trying to
bold-face the first column of a two column table. I try the following five
variations (the five tables in the demo are assigned classes a, b, c, d, and
e, respectively):

table.a td:first-child { font-weight: bold; }
table.b tr td:first-child { font-weight: bold; }
table.c tr > td:first-child { font-weight: bold; }
table.d > tr td:first-child { font-weight: bold; }
table.e > tr > td:first-child { font-weight: bold; }

The first three variations work in Netscape 7.01, Firefox 1.0, and Opera
7.54. The last two work in none of those browsers.

I've experimented and found that the cause has nothing to do with my use of
:first-child, because if I remove it, then all the cells in the first three
tables are bolded and none of the cells in the last two tables is.

It has nothing to do with the COL elements because the same thing happens
when I remove them.

I thought it might have something to do with using the > character in the
stylesheet, but I tried both changing it to > throughout and moving the
styles to an external stylesheet, and neither made a difference in the
outcome.

--
Harlan Messinger
Remove the first dot from my e-mail address.
Veuillez ôter le premier point de mon adresse de courriel.

Jul 21 '05 #1
4 1926
Harlan Messinger wrote:
I'm trying to bold-face the first column of a two column table. I
try the following five variations (the five tables in the demo are
assigned classes a, b, c, d, and e, respectively):

table.a td:first-child { font-weight: bold; }
table.b tr td:first-child { font-weight: bold; }
table.c tr > td:first-child { font-weight: bold; }
table.d > tr td:first-child { font-weight: bold; }
table.e > tr > td:first-child { font-weight: bold; }

The first three variations work in Netscape 7.01, Firefox 1.0, and
Opera 7.54. The last two work in none of those browsers.


Per the HTML recommendation, when <tbody> is not in the code, it is
implied, much like </p> or </li> when those end tags are missing. (Take
a look at the tree using the Mozilla DOM inspector and you'll see the
<tbody> element.) Try this instead:

table.d > tbody tr td:first-child { font-weight: bold; }
table.e > tbody tr > td:first-child { font-weight: bold; }

BTW, I realize that this is just a test case, but what's wrong with the
first 3 to do what you want?

--
Brian (remove "invalid" to email me)
Jul 21 '05 #2
In article <30*************@uni-berlin.de>,
Harlan Messinger <h.*********@comcast.net> wrote:
table.a td:first-child { font-weight: bold; }
table.b tr td:first-child { font-weight: bold; }
table.c tr > td:first-child { font-weight: bold; }
table.d > tr td:first-child { font-weight: bold; }
table.e > tr > td:first-child { font-weight: bold; }

The first three variations work in Netscape 7.01, Firefox 1.0, and Opera
7.54. The last two work in none of those browsers.


I think you will find that there is an implicit tbody between a
table and its tr - try 'table.f > tbody > tr ...'. Check with DOM
Inspector or Web Developers toolkit.

nhoJ
--
John P Baker
Jul 21 '05 #3

"JP. Baker" <cc***@shark.cse.bris.ac.uk> wrote in message
news:I7********@bath.ac.uk...
In article <30*************@uni-berlin.de>,
Harlan Messinger <h.*********@comcast.net> wrote:
table.a td:first-child { font-weight: bold; }
table.b tr td:first-child { font-weight: bold; }
table.c tr > td:first-child { font-weight: bold; }
table.d > tr td:first-child { font-weight: bold; }
table.e > tr > td:first-child { font-weight: bold; }

The first three variations work in Netscape 7.01, Firefox 1.0, and Opera
7.54. The last two work in none of those browsers.


I think you will find that there is an implicit tbody between a
table and its tr - try 'table.f > tbody > tr ...'. Check with DOM
Inspector or Web Developers toolkit.


Arg! Thanks for reminding me. That's the problem exactly. Damn TBODY!

Jul 21 '05 #4

"Brian" <us*****@julietremblay.com.invalid> wrote in message
news:UD*******************@bgtnsc05-news.ops.worldnet.att.net...
Harlan Messinger wrote:
I'm trying to bold-face the first column of a two column table. I
try the following five variations (the five tables in the demo are
assigned classes a, b, c, d, and e, respectively):

table.a td:first-child { font-weight: bold; }
table.b tr td:first-child { font-weight: bold; }
table.c tr > td:first-child { font-weight: bold; }
table.d > tr td:first-child { font-weight: bold; }
table.e > tr > td:first-child { font-weight: bold; }

The first three variations work in Netscape 7.01, Firefox 1.0, and
Opera 7.54. The last two work in none of those browsers.
Per the HTML recommendation, when <tbody> is not in the code, it is
implied, much like </p> or </li> when those end tags are missing. (Take
a look at the tree using the Mozilla DOM inspector and you'll see the
<tbody> element.) Try this instead:


Yup, that's exactly it, I'd forgotten to impute a TBODY.

table.d > tbody tr td:first-child { font-weight: bold; }
table.e > tbody tr > td:first-child { font-weight: bold; }

BTW, I realize that this is just a test case, but what's wrong with the
first 3 to do what you want?


Oh, I just meant to show where in which the shift from using descendent
selectors to using child selectors the problem began to appear.

Jul 21 '05 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

10
by: Larry Woods | last post by:
Look at this code: Dim i As Integer = 0 Dim j As Integer = 5 If (j / i = 7) Or i = 0 Then MessageBox.Show("In If") Else MessageBox.Show("In Else") End If
1
by: Paul Remblance | last post by:
Hi, 1. I have a MdiParent form called MDIParent in the namespace KLCost. 2. Which opens a child form (selection). 3. Which I would like to open multiple windows from selection but make them...
0
by: Ambica Jain | last post by:
I have a data grid called Files, which has some columns like FileName, Col1, Col2, ... , Col8. Then i have a combobox which allows user to select from Col1 to Col8 and based on this selection, i...
5
by: cmk128 | last post by:
Hi All Is there any alternative way to let parent class hold a vector of its child class's objects? I meant when i create an object from the child class, in the parent class, i am able to...
8
by: Rick | last post by:
VS 2005 I' m setting up a parent/child datagridviews in a form. I am doing a lot of this by hand coding in order to get the feel of things. I want a change in the parent table to trigger a...
0
by: =?Utf-8?B?S2Fp?= | last post by:
Hi all, I have a ASP.net VB 2.0 application with AJAX Control Toolkit (updated just some minutes ago to latest 10618 from 18. June 2007). Initially everything works fine: I have an overview...
5
by: BibhuAshish | last post by:
Hello, I have one child window. in child window i am selecting one radio button. i want to return that selected value to parent window. To open child window in parent window, i have written like...
15
by: (PeteCresswell) | last post by:
Some time within the next nine months, there's a pretty good chance I'll have the "opportunity" to port a bond trading system that I wrote - whose front end is currently MS Access - to .NET. ...
7
by: =?Utf-8?B?U2hpdmEgUmFtYW5p?= | last post by:
I have a windows application with multiple forms & another web application. Now I need a parent EXE or Application which need to act as a container to these application. Example : My existing Web...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
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...
0
tracyyun
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...
0
agi2029
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,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.