By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
459,503 Members | 1,188 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 459,503 IT Pros & Developers. It's quick & easy.

css can you reference an element withen an element

Plater
Expert 5K+
P: 7,872
The title might not make sense, but I wasn't sure how to word it.
Lets say I have the following code (which is auto generated so I cannot supply an id or class in the caption element)
Expand|Select|Wrap|Line Numbers
  1. <table class="gv" id="gvClientTracking" >
  2. <caption >
  3. Client Sites(10)<br/>
  4. </caption>
  5. <!-- etc, assume correct table structure and closing tags -->
  6.  
I can say in CSS
Expand|Select|Wrap|Line Numbers
  1. caption
  2. {
  3.    text-align: left;    
  4. }
  5.  
But I was really wondering if I could do something like
Expand|Select|Wrap|Line Numbers
  1. #gvClientTracking caption
  2. {
  3.     text-align: left;
  4. }
  5.  
Or in some manor refer to ONLY caption elements that come inside an element with the id "gvClientTracking" (or elements with class "gv" would be ok too)

I really though I had read about this once, but cannot figure out how to look it up now.

Is that possible, or am I getting it confused with some xml styling abilities?
Oct 1 '08 #1
Share this Question
Share on Google+
2 Replies


drhowarddrfine
Expert 5K+
P: 7,435
Yes you can using CSS "selectors". Unfortunately, they only work in modern browsers and not Internet Explorer though IE7 can handle a few of them with bugs. I'm heading out the door so here's a link to the spec or you can google for a tutorial on it. Here's a link to what works in which browsers.
Oct 1 '08 #2

Plater
Expert 5K+
P: 7,872
Hmm well the goodnews for me is it works in ie6/ff3/chrome.2 with the
Expand|Select|Wrap|Line Numbers
  1. .gv caption
  2. {
  3. }
  4.  
selector type. That should handle everything I need for this instance.
Oct 1 '08 #3

Post your reply

Sign in to post your reply or Sign up for a free account.