|
|
|
|
|
|
|
|
|
|
Keep lookin' good with Cascading Style Sheets (continued)
You can include as many rules as you want in between the <STYLE> tags.
You can find the style declaration attributes and values for Microsoft Internet Explorer at http://msdn.microsoft.com/library/default.asp?url=/workshop/author/css/reference/attributes.asp.
Using CLASS and ID to reference selectors Okay, so now we've got some embedded CSS rules and they have selectors. How do we use the rules?
It's easy. The only thing you need to do is add a CLASS or ID attribute to the HTML page element that you want to apply the rules to. If you're going to use CLASS to reference CSS rule selectors, then the rule inside the <STYLE> tags must be prefixed with a full stop. Have another look at the example above and you'll notice that in the style sheet, "myrule" is prefixed with a full stop. Similarly, using ID to reference CSS rule selectors requires that the rule inside the <STYLE> tags must be prefixed with the "#" symbol.
The last two rows of the above example show how to use CLASS and ID to reference the rule selectors in the style sheet. The example includes two <p> elements, one using CLASS to refer to a selector and one using ID to refer to a selector.
Easy, isn't it?
Linked CSS So far we've seen that inline CSS gives you fine control over individual page elements. Embedded CSS allows you to make global changes across an entire HTML page.
Linked CSS goes one step further and stores the style sheet outside the HTML page. This means that multiple HTML pages can refer to the same linked CSS file. Thus you can make changes in a single location, and those changes will apply to all of the HTML pages that use that linked CSS file.
I've separated the style sheet rules from our example into a file. This will be our linked style sheet. For your convenience, I've stored the linked style sheet on my Web server at http://www.touchdown.com.au/dpmay2002.css. These are the contents of the linked style sheet:
.myrule {
font: 23px Verdana, Geneva, Arial, Helvetica, sans-serif;
color : green;
font-weight:bold }
#anotherrule {
font: 50pt Arial, Helvetica, sans-serif;
color : purple;
font-weight:italic }
|
Okay, now that we have a linked style sheet available, load the following into a Web browser, and you'll see how easy it is to get linked CSS working for you.
Conclusion Cascading Style Sheets is one of my favorite standards/technologies. Style sheets are very simple to understand and implement, and give excellent results.
The results you get from using Cascading Style Sheets easily outweigh the effort that you need to put in (which is, effectively, none).
Take a little time to explore the CSS reference guides and your software will look better and cleaner and you'll be able to add that cool factor without the need for graphic designers, time, or cost.
[ Prev | Next ]
|
|
|
|
|
|
-- Advertisement --
2-Minute Tutorials
How do I...
- integrate MS Office or OpenOffice with Notes?
- create cross-tab reports and charts?
- print serial letters and mailing labels?
- create PDFs in Lotus Notes?
Check out the 2-minute tutorials here. |
-- Advertisement --
How good are your Notes Reports?
Integra for Notes provides high value reporting and data analysis from Lotus Notes databases using Microsoft Word, Excel and PDF files.
- Enhance traditional static reports with Excel data analysis, pivot tables, macros
- Report from any Lotus Notes databases without changes to database design
- Runs reports through a Lotus Notes client and a web browser
- Enables Report scheduling or distribution by e-mail, printing or storing in a Notes database
- Allows use of LotusScript for advanced data manipulation
Enables self service reporting capabilities to end-users.
Click for more info. |
|
|
|
|
|
|
|
|