| |||||||||||||||||||
|
| |||||||||||||||||||
HomeWeb DevelopmentShort ContentsFor Beginners...Introduction Changes from 3.2 Document Attributes ...that are available for all BODY objects Text Organisation tools Forms Images Sounds Style Sheets Special Effects - Javascript Search Engines Full ContentsFor Beginners...IntroductionOther HTML sitesPutting pages online Tips For beginners Download this Guide Changes from 3.2DocumentSpecifying LanguageStructure The <HEAD> section ...General attributes ...Title ...Setting the Base address ...Queries : ISINDEX ...META tags ...Character sets ...<LINK>s The <BODY> tag ... General Attributes ...Document Colours ...Background Attributes...that are available for all BODY objectsTextHeadingsFonts Preformatted text Change text direction Special Characters Character Formatting ...Blink ...Bold ...Italics ...Underline ...Strikethrough ...Superscript ...Subscript Paragraph formatting ...Blockquote ...Line Breaks ...New Paragraph ...Stop Line Breaks ...Word Break ...Centre text ...Marking Modifications Miscellaneous ...Abbreviation ...Acronyms ...Addresses ...Use Bigger/Smaller fonts ...Citations ...Code ...Definitions ...Keyboard input ...Sample ...Teletype ...Variables ...XMP Organisation toolsCommentsHorizontal lines DIV and SPAN Links ...<LINK>s ...within pages ...Image maps Frames ...Naming and Targeting ...Inline Frames Tables ...example tag ...Rows ...Cells ...Captions ...Head, Body & Foot Lists ...Definition lists ...Directory Lists ...Menu Lists ...Ordered Lists ...Unordered Lists Embedding special files The Object Element FormsInputs and buttonsSelection menus Element Labels Fieldsets and legends ImagesSoundsStyle Sheetsspecifying versionindividual elements in the HEAD section specifying media types external sheets cascading sheets media-dependant defaults HTTP headers Special Effects - JavascriptEvents...onAbort ...onBlur ...onChange ...onClick ...onError ...onFocus ...onLoad ...onMouseOver ...onMouseOut ...onReset ...onScroll ...onSelect ...onSubmit ...onUnload Basic Commands ...Changing the status bar ...Opening a new window ...changing page being viewed Search Engines |
Style SheetsTHIS IS NOT A STYLESHEET GUIDE!! This is only a quick guide on how to use style sheets in HTML documents. For the CSS specification, see my CSS guide or the W3C site. Setting the default style sheet languageTo use style sheets, you should tell the viewing program what language you are using. The default, and most common, is currently "css", but you should still define this, either by the meta tag:<META http-equiv="Content-Style-Type" content="text/css">or the following HTTP header : <Content-Style-Type: text/css
>This information can also be specified with the type="???" attribute in the opening <STYLE> tag. Setting Style Info - individual elementsThis is done by adding the style="???" attribute to the opening tag of the element, where ??? is the style information in the form name: value, with each seperated by a semi-colon (;). For example,<P style="font-size: 10pt; color: white">
Setting Style Info - in the HEAD sectionAll of the document's style information can be set in the HEAD section of the document,as seen by the following example:
<STYLE type="text/css" media="all">
<!--
H1 {style info for all H1 elements}
H1.classname {style info for H1 elements assigned to classname}
#idname {style info for a single element with id="idname"}
-->
</STYLE>
Note that the <!-- --> comment tags are intended to prevent the contents being displayed if style sheets aren't supported.The above shows the three ways in which style infromation can be specified:
Selecting the media typeAs you may have spotted in the above example, Style sheets have provision for the media="???" attribute. This allows you to specify different style information for different viewing devices. The value is a comma seperated list of the below values, where the names are case sensitive...
Setting style from another fileThere are three ways in which you can specify an external style sheet :
Cascading Style SheetsYou can also specify information in addition to what is given in the LINKed style sheets, by using the <STYLE> element as normal, after the LINKs.Media Dependant DefaultsYou can set a different default for different types of media, by seperate<LINK href="stylesheetname.css" title="(your title or description)" rel="stylesheet" type="text/css" media="???"> links for each media type. The LINK that applies to all other media types should be placed last, without the media= attribute.
Using HTTP headersInstead of the HEAD tags as described above, you can also use the following format, placed before the HEAD section :Link: <filename.css>; rel="stylesheet"; title="(your title)"
(C)opyright, Geoff Knagge.
Continued use of this site indicates your agreement to the Conditions of use and Privacy Policy. | ||||||||||||||||||