Friday 21st of November 2008 07:26:31 PM

CSS Tutorials

CSS Tutorials

Welcome to the CSS Tutorials. In this section we cover Cascading Style Sheets, the powerful supplement to HTML that allows you complete control over the look of your websites. We'll show you how to create Cascading Style Sheets, and some of the cool tricks you can achieve with them.

For Beginners...

Introduction to CSS
This tutorial covers the basics: what are style sheets? How do I make a style sheet? It also shows some of the cool things you can do with style sheets.

CSS Units
A description of all the units that can be used with CSS, including lengths, percentages, colours and URL's.

For Intermediate Users...

Controlling Background Images and Colours
Learn how to use CSS properties to add background images and colour to your Web pages. Lots of neat tricks and examples are included!

Controlling Fonts with CSS
In this tutorial we take a look at how to control the fonts used in your page body text, using the various font properties that can be controlled with style sheets.

Controlling Text Appearance with CSS
This tutorial shows you how to control the layout of your text using the text properties available in CSS, such as line spacing and text alignment.

Making Lists Look Nicer with CSS
You can really go to town with HTML lists when you add a sprinkle of CSS! This tutorial shows you how to make your lists stand out from the crowd.

For Advanced Users...

CSS Positioning
This tutorial teaches you how to use CSS to position images, text, and other elements on your Web pages. Essential reading for anyone who wants to start using CSS for layout.




P {margin-left: 100px; margin-right: 100px;} /* same as before */

WARNING

In practice, only browsers released in early 1999 or later correctlyhandle auto, and not even all of them get itright. Those that do not handle auto marginscorrectly will behave in inconsistent ways, but the safest bet is toassume that they will set both margins to zero. The browsers that doget this right are Internet Explorer 4.5 and 5 for Macintosh, andOpera 3.6. H1 or a P element. Figure 7-36 illustrates one way to handle these threekeywords, as well as how they relate to each other and to the contentthey surround.

Figure 7-36

Figure 7-36. The relation of border-width keywords to each other

Let's suppose a paragraph has margins, a background color, anda border style set as shown in Figure 7-37:

P {margin: 5px; background-color: silver; border-style: solid;}
Figure 7-37

Figure 7-37. Margins, backgrounds, and borders

  • XML parsers allow you to code faster by giving you a parser for your all your XML documents (with and without DTDs).
  • XML documents are easily committed to a persistence layer

    XML documents may be stored in files or databases. When stored in files, XML documents are simply plain text files with tags (and possibly DTDs). It is very easy to save your XML documents to a text file and pass the text file around to other machines, platforms and programs (as long as they can understand the data). In the worst case scenario, XML documents (files) can be viewed in a text editor on just about any platform.

    XML documents are also naturally committed to a database (relational or object) or any other kind of XML document store. There are commercial products available which allow you to save XML documents to an XML storage layer (which is not a database per se), like Datachannel's XStore and ODI's eXcelon. These XML store solutions are quite expensive ($10,000 to $20,000 range).

    P {margin-left: 5em; position: relative;}<P> Lorem ipsum, dolor sit amet, consectetuer adipiscing elit,sed diam nonummy nibh euismod tincidunt ut <SPAN CLASS="change">***</SPAN>laoreet dolore magna aliquam erat volutpat.</P>
    Figure 9-22

    Figure 9-22. Another approach to defining a "change bar"

    Remember when we mentioned static-position muchearlier in the chapter? Here's one example of how it works andhow it can be very useful.

    Another important point is that when an element is positioned, it <LINK REL="stylesheet" TYPE="text/css" HREF="link-styles.css"TITLE="Linked"><STYLE TYPE="text/css">@import url(import-styles.css);</STYLE>

    Because Explorer will read in both style sheets, it will use thecascade to determine which rules should actually be applied. Ifyou've ordered things correctly, and the imported style sheetcomes after the linked style sheet, its rules will win out over therules in the linked style sheet.