CSS - Demo of the Basics |
||||
|
||||
|
Featuring:
CSS- We apply the previous basics to change our complete page styling Motivation: See how much can be accomplished with basic CSS knowledge This will be a test of 2 things - first how easy or hard is it to make complete changes to a website using the basic CSS which we have learned so far. Second we have added two new CSS stylings as well - use of a background image, and changes to the <a> link tag so we can create menu like behavior for our tags. Other than that everything is the same old, same old basic CSS we have been learning so far. The Change Over
body, h1 {
background-color:#442200;
background-image:url(images\backcss.gif);
background-repeat:repeat;
font-family: Helvetica, sans-serif;
color:#FFFFff;text-align: justify;
}
p, table, td, tr {
background-color: #331100;
font-family: Helvetica, sans-serif;
font-size: 11pt; color:#ffffcc;
padding-left: 12px;
padding-right: 2px;
padding-top: 6px;
padding-bottom: 2px;
}
a.menu {
font-family: arial, helvetica, sans-serif;
font-weight: bold;
text-decoration: none;
background-color: #cc4400;
margin-left: 2px;
margin-right: 2px;
color:#000000
}
a.menu:visited {
color:#990000
}
a.menu:hover {
text-decoration: underline;
color:#990000
}
I then added a new style linkage to this file using the standard code we just learned in Core Basics 101: Voila - I am done and this is the styling of the new page. No brownie points will be earned by the styling of this new page except perhaps in the Woofie awards. However, the exercise is useful in demonstrating how completely one can change a web page (or site for that matter)with fairly simple changes contained in one .CSS file. The changes are to background color and image, font style, size and type, padding at the margins, and how links look and work. In the latter case we have added a few wrinkles that give the links a menus look. Now for the details on those changes. The first CSS style changes all <body> and <h1> tags. Whenever they are used they will: 1) Have a background color of chocolate just in case the background image cannot be found; otherwise they wail show the background, repeating gif image of CSS styling statements in black type on brown; The second styling applies to all <p> paragraph, <table>, <tr>-table row, and <td> - table cell tags. Whenever they are used they will: 1)Use a darker, burnt sienna background color; You can clearly see the padding on the left because the code which is under the <pre> tag has no padding and so it is closer to the left margin. In an upcoming tutorial I shall explain CSS's box model for margins, border and padding around text. In the meantime I want to explain the next three styling which all apply to the <a> tag. As I noted at the beginning, the desire is to make links look and work more like menu items. Hence the a.menu style which says that all links (i.e. <a href="..."> tags) with the class="menu" setting will do the following: 1)Use the font Arial, Helvetica and sans-serif in that order if available: But there is more. The a.menu:hover style is based on the a.menu style and takes all its properties. However, the Descriptor for a.menu:hover determines what will happen when a user hovers a mouse over the <a> tag. It will change its font color to deep red and add an underline. So as soon as the mouse hovers over this link it changes in color and underline enough that the user knows along with the change of the cursor to a pointing hand (this is consistent browser behavior), that this is a link or menu item. Clicking on it will take the user elsewhere on the Web, trigger a program and all the things possible using a link. There is one more touch: the a.menu:visited style. This style is used to let users know when they already have visited a page. Again, it inherits all the properties of the a:menu style but overrides the font color changing it from black to dark red. Here is what happens when a link does not contain the class="menu" - go to CSS References. The default <a> tag style from the original osstyle.css stylesheet takes precedence in this case. This will become a recurring theme in our tutorials; which style applies depends on a cascading set of rules. Like Selector targeting, cascading rules go from simple to very complex . We shall try to balance effectiveness with "requisite complexity" in our coverage of CSS.
Finally we have changed the JavaScript code used with Google ads to conform with the new colors. Also the <cite> tag works differently in the various browsers about where it inherits its properties from. So I have changed it to a new .citer style class and substituted a <blockquote>.This is another legacy from the browser wars and the fact that Microsoft stopped all updates to IE6 for 7 years and still has not met its commitments to full CSS implementation from 10 years ago. |
||||
Top of Page Tutorials Home CSS references |