Scott Swabey wrote: > Shirley Harshenin wrote: > >> I am working on a page that has both light and dark backgrounds >> therefore need two different colors for links (dark color link for >> light bg, light color link for dark bg). HOW do I code that? I've >> tried creating a new style (in CSS) but the main content style >> over-rides it. :( >> > > Hi Shirley > > You will need to use the cascade to identify the elements you want to > target. For example: > > [html] > <div id="lightback">light background <a href="#">link</a></div> > <div id="darkback">dark background <a href="#">link</a></div> > > [css] > /* backgrounds */ > div#lightback { background-color: #fff; } > div#darkback { background-color: #000; } > /* links */ > #lightback a { color: #000; } > #darkback a { color: #fff; } >
Shirley, Just for more background on Scott's answer, what he is showing you are descendant selectors. They are very powerful and learning to use them makes your CSS a lot more lean. I highly recommend this tutorial on CSS selectors: http://css.maxdesign.com.au/selectutorial/ Zoe -- Zoe M. Gillenwater Design Services Manager UNC Highway Safety Research Center http://www.hsrc.unc.edu ______________________________________________________________________ css-discuss [EMAIL PROTECTED] http://www.css-discuss.org/mailman/listinfo/css-d IE7b2 testing hub -- http://css-discuss.incutio.com/?page=IE7 List wiki/FAQ -- http://css-discuss.incutio.com/ Supported by evolt.org -- http://www.evolt.org/help_support_evolt/