![]() | |
| |
HomeWeb DevelopmentShort ContentsIntroductionCSS Basics Selectors Terminology Media Types Paged Media Aural Media Colours Fonts Text Blocks Lists & counters Tables Miscellaneous Full ContentsIntroductionChanges from CSS1Other CSS sites Download this Guide CSS BasicsSetting StylesUsing external files ...media dependant Setting Style values Comments Inheritance Selectors...by class...by id ...contextual ...all elements ...if a child ...adjacent elements ...by attributes Psuedo Classes ...<A> links :hover :active :focus :lang :firstchild Psuedo Elements ...first line ...first letter ...:before and :after ...inserting content TerminologyCascades"! important" CSS element model Block elements Guide Terminology Units ...lengths ...colours Media Types...giving style...supported types Paged Mediamarginspage size crop marks left, right, first pages page break before page break after page break inside page names orphaned content widowed content Aural Mediavolumespeak pausebefore pauseafter pause cuebefore cueafter cue playduring azimuth elevation speech rate voice family average pitch pitch range stress richness punctuation numbers table headers ColoursForeground colourBackground ...-color ...-image ...-repeat ...-attachment ...-position FontsFont...-family ...-style ...-variant ...-weight ...-size ...-sizeadjust ...-stretch Textword-spacingletter-spacing text-decoration text-shadow vertical-align text-transform text-align text-indent line-height quotes Blocksindividual marginsall margins individual padding all padding border widths all border-widths border-color border-style individual borders all borders width min width max width height min height max height float clear position ...where layered position text direction bidirectional override line height vertical align overflow clipping visibility Lists & counterslist-stylelist-style-type list-style-image list-style-position marker offset resetting counters incrementing counters nesting counters counter appearance displaying counters Tablescaption positionlayout method border display border spacing empty cells MiscellaneousDisplayRun-in boxes whitespace cursors outline outline width outline style outline colour |
Style Sheet BasicsSetting Style in HTMLThere are three ways to specify style sheet information...
Setting style from another fileThere are three ways in which you can specify an external style sheet :
Media Dependant DefaultsYou can set a different default for different types of media, by seperate<LINK href=" links for each media type. The LINK that applies to all other media types should be placed last, without the media= attribute.
See the media page of this guide for allowable values of mediatype. Basics of specifying CSS informationWhen style information is specified in the <STYLE> tags or external files, 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. |