Josh Ghiloni wrote: > Hi All. > > I have a bit of code that, for example, looks like this: > > <style type="text/css"> > div { color: blue } > div[dir="rtl"] { color: red } > </style> > > <div dir="rtl"> > hi! > <div>bye!</div> > </div> > > As I somewhat expected, the outer (hi!) text rendered red, whereas the > inner child is rendering blue. Is there a way I can define my styles > such that div[dir="rtl"] and any children (at any level and whose dir > is not explicitly "ltr") all match the same style? Alternatively, is > it bad form to not explicitly set the dir attribute on the divs inside > a div whose dir attribute is "rtl"? > > Thanks a lot! >
If your question is "how can it arrange the styles so that what's inside of the div with [dir="rtl"] will inherit its styles", there are different approaches to this depending on how your document and CSS styles are structured. In the example you gave, if you were to declare "div[dir='rtl'] div", that would mean "all divs that are a descendent of a div with the attribute dir=rtl" will have that property. Of course, you could always use the down and dirty method by using the universal selector, as in div[dir='rtl'] *, which will apply to all elements descending from div[dir="rtl"] - but it's best to exercise care when using an approach like this. You are about to take a big step forward with your skills now that you are try to grasp one of the most essential concepts in CSS, namely inheritance and specificity. There are many great resources for study, and great tools to help you figure out how to target your styles. Start with http://www.456bereastreet.com/archive/200509/css_21_selectors_part_1/ , which is a very good article that will help clarify many things. The deeper your understanding of inheritance, specificity, and the Box Model, the greater your skills will become. Keep at it! ______________________________________________________________________ css-discuss [EMAIL PROTECTED] http://www.css-discuss.org/mailman/listinfo/css-d List wiki/FAQ -- http://css-discuss.incutio.com/ List policies -- http://css-discuss.org/policies.html Supported by evolt.org -- http://www.evolt.org/help_support_evolt/