For at least as long as I've been on the Internet, whenever a browser-related thread comes up in the Acorn newsgroups, people end up talking about the deficiencies of RISC OS browsers when compared with Internet Explorer or Netscape. We often end up with a list of things that RISC OS browsers "need to support" before RISC OS can become an accepted platform for Internet access. Over the years, this list has gradually got smaller. First came JavaScript, then (eventually) SSL, and then, earlier this year, a freeware Flash player was released. However, one big thing still remained: CSS support.
One of the first things I did when I got to the Wakefield show this year was to walk over to Castle's stand and have a play with their new browser, Oregano, which was released at the show. To my surprise, I saw in the help files that "limited CSS support" was one of the features listed as having been introduced in the latest version. I got chatting to one of the software engineers, and he said that basic CSS support had only been added a few days before the show, which was why it hadn't been announced. Since then, support for a few other CSS elements has been added, and while the support is still very limited, the groundwork is there, so it can only get better over time.
Stylesheets allow the application of styles to Web pages without breaking the structure of the document. One of their main advantages is that they degrade gracefully, so that sites that use them can still be displayed perfectly acceptably with browsers that don't support CSS.
<H1><FONT COLOR="#0000FF">A heading</FONT></H1>
Wouldn't it be easier if you could just tell the browser to display all headings (i.e. text surrounded by <H1> and </H1>) in blue? That's where CSS comes in. To achieve this effect, all you'd have to do is to create a simple stylesheet that contains the following:
H1 {
COLOR: #0000FF;
}
Easy!
The declarations for each selector are enclosed in curly brackets ({ }). This allows you to apply more than one style to a HTML tag; for example, you might want to do this:
H1 {
BACKGROUND: #EEEEEE;
COLOR: #0000FF;
FONT-STYLE: italic;
}
This will display all text surrounded by <H1></H1> in blue, italicised letters with a grey background.
P.summary {
BACKGROUND: #EEEEEE;
}
Then, in your HTML code, you need to assign the class to the paragraph that you wish to apply the style to:
<P CLASS="summary">Text goes here.</P>
And that's all you need to do! You can create as many classes as you like, and they can be applied to almost any HTML tag.
| Included with this article is a simple page demonstrating some of these features, which is intended for viewing in Oregano. For those of you who are using a different browser, a screenshot of what the page looks like in Oregano is also provided (to see it, click on the thumbnail image to the right). |
|
<LINK REL="stylesheet" TYPE="text/css" HREF="style.css">
The HREF should contain the path to the location of the stylesheet (so it might be something like ../../mystyles.css).
<HTML>
<HEAD>
<TITLE>Embedded stylesheet code example</TITLE>
<STYLE TYPE="text/css">
<!--
H1 {
COLOR: #0000FF;
}
-->
</STYLE>
</HEAD>
<BODY>
<H1>A heading</H1>
<P>Some text!</P>
</BODY>
</HTML>
As with all aspects of Web site design, the simplest way to learn is to look at other people's code and then experiment yourself. For example, if you view the source of this very page you'll discover that Foundation RISC User uses a linked stylesheet, which can be found here. (It's a very simple stylesheet that causes links in the text to turn red while the pointer hovers over them; a feature which is not yet supported by any RISC OS browser.) So, have a look and then add some styles to your own Web site!