The Structure of the Spruz Social Site -- Basic: The Element Tree
In order to know why our CSS selectors do or do not work for us, it's necessary to understand the basic structure of the page we are trying to style. Microsoft provides a useful one-key tool in Internet Explorer to analyze web pages, and its the F12 key. I use IE version 9. Going to a popular Spruz site, and pressing F12, we get a tree of elements provided by IE.
Selecting and expanding the body node, we see that the page consists of a stack of divisions separated by empty span tags. On the right are the CSS properties for body, and the CSS files which declare them. See also that the property "padding-top: 30px;" has been overwritten by another declaration "padding-top: 100px;" in the same file, style.css.
Older Spruz sites may have a slightly different configuration, or order, such as http://zrein.aowc.net/ created by the popular and well known Spanish artist, Anaclara Gonzalez Hinojal, known by her nick, Zrein. I am very fond of her work, and love the way she does her sites. Next, take a look at the division with id #container. Just about everything we do on our page is going to be done in this container element, and it determines the width of our page.
Note on the right that our page width is set by the file style.css at 980px. This is the default page width set for a Spruz Social Site. To change it we would have to override the line with code of our own. Within the container division is another container, a table with id #site-container-table. This a repeated combination in the Spruz site: table within a division. Now see the innocent looking td element under the table? Therein lies a tale and a trap.
The td trap:
Note that the td element has no id or class assigned to it. It would be better if it did. It's not a critical issue, but it does present a trap. If you (or some script you install) try to set a global style for the td element, you will be setting it for almost every element on your page. And you will succeed unless some other style sheet overrides your efforts. To see what I mean, install the line td {font-size:36px !important;} between style tags in a text box on your page, and watch the fun. Td sets the default font style for your page as 10pt arial.
Remember, if you set a style for an element, you set it for every element that it contains, and that will happen unless some declaration elsewhere overrides it. Most of the styling we will be doing involves three divisions within the td element:
It will be div #page-header, div #login-area, div #master-table-container that we are concerned with. To summarize: We must understand the order of the element tree to to understand what properties are being inherited by an element from its containers and from other style sheets. This will enable us to see better why our styling is or is not successful.
(to be continued)