• Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • PrintPrint
Share this Page URL
Help

Chapter 2. Mastering CSS > Using Grouping and Context

Using Grouping and Context

Although it is common to group selectors either to combine their definitions (separated by commas) or to set up contextual styles (separated by spaces), the full power of these CSS features often goes unnoticed.

Consider Code 2.4. This sets up styles to create two different columns (colA and colB) defined by IDs and then sets up two different areas (area1 and area2) as classes. In the body then, the two columns are set up using <div> tags with both areas repeated in columns 1 and 2. And yet when displayed in a browser (Figure 2.8) the areas have a different appearance depending on the column they are in.


PREVIEW

                                                                          

Not a subscriber?

Start A Free Trial


  
  • Creative Edge
  • Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • PrintPrint