CSS is a formatting language, used to provide more customised web pages and make it easier to make multiple pages use the same style.
CSS is an acronym that stands for
Cascading Style Sheets. Sadly not all browsers handle CSS even though it is the best formatting language produced to date.
Some very popular browsers do not handle it as well as they should. Noteably Microsoft Internet Explorer and several browser differences in rendering need to be overcome.
Whenever you look at a theme in Xoops be sure to remember adjustments for styleMAC and styleNN. To see if a style has been well written, simply compare the same page in IE and Mozilla Firefox. Ideally both will display correctly and without differences, but this is not always possible.
Using CSS, you can define colours, backgrounds, borders, margins, alignment, fonts, sizes and many of other things for almost any part of your web pages.
The word
cascading describes many of the features of CSS. Firstly, it means that many stylesheets can be used and will be merged by the browser to provide a computed style for each element.
If styles defined for one element oppose each other, the later one will be used, unless another one more specifically refers to the element (for example, if all paragraphs are made red, but a paragraph that is in a
<div>
is made blue, the blue will override the red for paragraphs in a div, as it more specifically refers to the desired element).
Cascading also means that each object inherits from its parent object or parent class. The parents are not the same as the parent objects in JavaScript but use a similar idea. The objects are refered to by their element tag. The highest object in the structure is the body. If any elements do not have their own CSS defined but the body does, then the cascading behaviour means they will inherit from the body. So, if in the body we define the text colour to be white, then any tables will also have white writing in them
Each element can be in a
class. For example, if we define the 'p' tag to have a text colour red then every paragraph will be red. But if we then define a class of paragraph called mybold where the text is bold and we create a paragraph of class mybold, it will have bold text. But remember that style sheets cascade and elements inherit from their parent class, so the text in the paragraph of class mybold will also be red. If we define the class mybold to have blue text then the blue will override the red and the text in the paragraph of class mybold will be blue.
One of the features of CSS is that if the browser does not understand something, it will ignore it and move on to the next attribute (except Netscape 4 when using inline styles.) It will not display warnings.
This FAQ is not intended to teach you all of the many possible styles that you can apply, it is intended to illustrate to you the syntax expected with CSS.