The Kingdom of CSS, an allegory of inheritance

Category: SaaS Management

In the kingdom of CSS, everyone has their place. The elements, (the DIVs, the As, the LIs, even BODY and TABLE) are the peasants. They do what they are told. Sometimes they have their own ideas about how things are supposed to be, rebellious UL likes his space, for instance, and prissy A likes to be bright blue and underlined like a tramp on the street corner, but some good hard rules quickly put that out of their minds. They are the lowest, widest rung of the CSS kingdom, and as badly as we may treat them, the website would not exist without their labor.

If elements are the peasants, however, classes are the nobles who tell them what to do. Like all oligarchies of inheritance, there can be many nobles giving orders to one peasant element, who, poor soul, follows what the first one says and hopes for the best.

Some classes issue simple, broad orders to massive armies of elements. Others are hyper-specific, running their single element as a miniature dictator. They are all bossy, and like to overwrite each others orders whenever possible. All classes, however, bow down to the royal id.

In the kingdom of CSS, the id is king. While there might be many noble classes, each element only ever has one king, and for that element, the king’s word is law, no matter what the attached classes might say. The king’s orders always override the noble’s orders, no matter how far down the line of inheritance they might be.

However, when visiting the kingdom of CSS, there is one final truth you must always keep in mind: Heaven is high and the style sheet is far away. Though the id may be king, and the class may be noble, the inline style is the man with the knife in your back, and no iron-clad order from on high outweighs a narrow inch of steel in your spinal column, or your tag, as the case may be.

Recommended Further Reading