Css Notes/ Reviewer W3C and Recommendations
Css Notes/ Reviewer W3C and Recommendations
CSS (Cascading Style Sheet) is a stylesheet language that describes the presentation of a
webpage which is a recommendation from the World Wide Web Consortium (W3C).
In essence it controls the design, layout and other aspect of a webpage.
Note: In CSS 3 - documents are divided separately and are called "modules". Each module in
turn adds new capabilities or extends features defined in previous versions. Due to the
modularization, the different modules in CSS3 have different stability and statuses. So there was
a shift from Recommendation to Individual Specification (Modules)
Internal Style
Syntax used to use an internal style
<style type="text/css">
selector {property: value;}
</style>
Inline Style (Remember inline style has the highest priority because it could override
other styles but it has limited scope because it could only be applied into a particular
element on a single page. Avoid using this type of style because it is hard to control
and update especially when it is scattered all over your website)
Syntax used to use an internal style
<tag style="property: value">
Font-Family
There are 5 font families namely: Serif, Sans-serif, Cursive, Fantasy and Monospace.
The commonly used font family is the serif and sans-serif.
Examples of Sans-serif fonts - Arial, Calibri, Comic Sans MS, Tahoma, Verdana
(Remember sans-serif fonts are ideal to be used if the target output is screen meaning
computer monitors or LCD projectors)
Remember when writing your CSS always start with the font that you want or you prefer
the most, and always end with a generic family.
It is also important to take note that when writing the name of the font in CSS - if it is more
than one word like Times New Roman, it is important that it is enclosed with a double
quotes for it to work.
Ex. “Times New Roman”
Color
The basic color used by computers are red, green and blue (RGB)
(When these three colors are mixed in combination it could produce 16,777,216 colors)
There are 3 ways to specify color in CSS
1. Color name
Years ago there were only 16 color names but now there are about 140 color names
that are available
Examples of color names are: blue, lightblue, skyblue, lightskyblue, steelblue,
royalblue
3. RGB value
This way of specifying color uses the numbers 0 to 255
Example of a CSS rule using rgb values p{color:rgb(255,0,0);}
Font-size
There are many unit of measurement used for font sizes but the most commonly used is px
which means pixel
Take note that one must be consistent in using a single unit of measurement, if one will use
px for an element all other elements should also use px.
In CSS one has to specify the numerical value of the size and then followed immediately by
the unit of measurement - example 20px. There should be no spaces between the numerical
value and the unit of measurement.
Other Properties for Fonts
Comments are additional information that are used to explain the codes. It is enclosed
between this symbols /* */
Example /* everthing between this symbols are considered as comments */