Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Child Nodes 2

Status
Not open for further replies.

vicvirk

Programmer
Feb 4, 2009
636
CA
how do I set the first "TD" within each "headerRow" to bold using CSS?

I'm attaching "{font-weight:bold;}" and have tried to access it by:

.headerRow > td:first-child

and

#container.table.headerRow > td:first-child

and

tr.headerRow:first-child

I know I can just wrap it in <strong></strong> but I'd rather use CSS, as there may be other styles that need to be attached to it...

Code:
<div id="container">
<table>
	<tr>
		<td colspan="2">Lorem Ipsum</td>
	</tr>
	<tr class="headerRow">
		<td>Lorem</td> [b]<- this one[/b]
		<td>Donec</td>
	</tr>
	<tr class="headerRow">
		<td>Nulla</td> [b]<- this one[/b]
		<td>Dolor</td>
	</tr>
	<tr>
		<td>Select</td> [b]<- [u]not[/u] this one[/b]
		<td>
			<select>
				<option value="a">a</option>
				<option value="b">b</option>
			</select>
		</td>
	</tr>
</table>
</div>

Thanks....

TIP: trying googling the answer before posting, you'll find that more times than not someone else somewhere has had the same request and posted an answer online.
----
I have recently been semi-converted to ensuring all my code (well most of it) works in both javascript and non-javascript enabled browsers
 
As far as I know, your first code should work, however, are you trying it out in a browser that supports :first-child pseudo class? Since it looks like the cells in question are sort of headers, you might want to use <th> for them, or wrap the whole thing in a <thead> element. Use semantic table elements to the fullest.

[small]Do something about world cancer today: Comprehensive cancer control information at PACT[/small]
 
Vragabond, I'm using IE 6 - I would be using 7, but my users are still on 6 and I can't upgrade until they do.

I'll use the <th> or just attach a class to it for now.

Thanks

TIP: trying googling the answer before posting, you'll find that more times than not someone else somewhere has had the same request and posted an answer online.
----
I have recently been semi-converted to ensuring all my code (well most of it) works in both javascript and non-javascript enabled browsers
 
By the way, IE6 does not support either of your two original methods.

Greg
People demand freedom of speech as a compensation for the freedom of thought which they seldom use. Kierkegaard
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top