![]() | |
| |
HomeWeb DevelopmentShort ContentsIntroductionCSS Basics Selectors Terminology Colours Fonts Text Blocks Classification Full ContentsIntroductionOther CSS sitesDownload this Guide CSS BasicsSetting Styles...setting values Comments Inheritance Selectors...by class...by id ...contextual Psuedo Classes ...<A> links Psuedo Elements ...first line ...first letter TerminologyCascades"! important" CSS element model Block elements Terminology used here Units ...lengths ...colours ColoursForeground colourBackground ...-color ...-image ...-repeat ...-attachment ...-position FontsFont...-family ...-style ...-variant ...-weight ...-size Textword-spacingletter-spacing text-decoration vertical-align text-transform text-align text-indent line-height Blocksmargin-topmargin-right margin-left margin-bottom margin padding-top padding-right padding-bottom padding-left padding border-top-width border-right-width border-bottom-width border-left-width border-width border-color border-style border-top border-left border-bottom border-right border width height float clear ClassificationDisplaywhitespace list-style list-style-type list-style-image list-style-position |
Style Sheet BasicsSetting Style in HTMLThere are four ways to specify style sheet information. For more information, see the HTML guides...
Basics of specifying CSS informationWhen style information is specified in the <STYLE> tags, it is given in the following format :selector1,selector2,...,selectorn { property1: value ; property2: value ; }That is, a list of HTML elements to which the style information is to be applied, followed by a list of that information, seperated by semi colons (;) and enclosed in curly braces. e.g. H1,H5 { color: blue}
CommentsThese are denoted by the/* ... */ comments pair used in C.e.g. H1 { color: red } /* comments go here */
Inheritance of Style InformationIf one type of HTML tag has no property assigned to it, and it is contained within another tag pair which does have a value assigned to that property, then it "inherits" the value of the tag in which it is contained.<H1 style="color:green"> text <EM>moretext</EM> end of heading</H1>Assuming that the <EM> has had no color specified elsewhere, "moretext" will be displayed in green, since it is within the green <H1> </H1> tags. In this way, you can set defaults by assigning them to the BODY element. Some values can be given as a percentage of what the inherited value would be. e.g. P { line-height: 120% } .
(C)opyright, Geoff Knagge.
Continued use of this site indicates your agreement to the Conditions of use and Privacy Policy. |