You are on page 1of 30

Three Ways to Insert CSS

There are three ways of inserting a style sheet: External style sheet Internal style sheet Inline style

External Style Sheet


An external style sheet is ideal when the style is applied to many pages. With an external style sheet, you can change the look of an entire Web site by changing one file. Each page must link to the style sheet using the <link> tag. The <link> tag goes inside the head section: <head> <link rel="stylesheet" type="text/css" href="mystyle.css"> </head> An external style sheet can be written in any text editor. The file should not contain any html tags. Your style sheet should be saved with a .css extension. An example of a style sheet file is shown below: hr {color:sienna;} p {margin-left:20px;} body {background-image:url("images/back40.gif");} Do not add a space between the property value and the unit (such as margin-left:20 px). The correct way is: margin-left:20px

Internal Style Sheet


An internal style sheet should be used when a single document has a unique style. You define internal styles in the head section of an HTML page, by using the <style> tag, like this: <head> <style> hr {color:sienna;} p {margin-left:20px;} body {background-image:url("images/back40.gif");} </style> </head>

Inline Styles
An inline style loses many of the advantages of style sheets by mixing content with presentation. Use this method sparingly! To use inline styles you use the style attribute in the relevant tag. The style attribute can contain any CSS property. The example shows how to change the color and the left margin of a paragraph: <p style="color:sienna;margin-left:20px">This is a paragraph.</p>

Multiple Style Sheets


If some properties have been set for the same selector in different style sheets, the values will be inherited from the more specific style sheet. For example, an external style sheet has these properties for the h3 selector: h3 { color:red; text-align:left;

font-size:8pt; } And an internal style sheet has these properties for the h3 selector: h3 { text-align:right; font-size:20pt; } If the page with the internal style sheet also links to the external style sheet the properties for h3 will be: color:red; text-align:right; font-size:20pt; The color is inherited from the external style sheet and the text-alignment and the font-size is replaced by the internal style sheet.

Multiple Styles Will Cascade into One


Styles can be specified: inside an HTML element inside the head section of an HTML page in an external CSS file Tip: Even multiple external style sheets can be referenced inside a single HTML document. Cascading order What style will be used when there is more than one style specified for an HTML element? Generally speaking we can say that all the styles will "cascade" into a new "virtual" style sheet by the following rules, where number four has the highest priority: 1. Browser default 2. External style sheet 3. Internal style sheet (in the head section) 4. Inline style (inside an HTML element) So, an inline style (inside an HTML element) has the highest priority, which means that it will override a style defined inside the <head> tag, or in an external style sheet, or in a browser (a default value). Note: If the link to the external style sheet is placed after the internal style sheet in HTML <head>, the external style sheet will override the internal style sheet!

CSS Syntax
A CSS rule has two main parts: a selector, and one or more declarations:

The selector is normally the HTML element you want to style. Each declaration consists of a property and a value. The property is the style attribute you want to change. Each property has a value.

CSS Comments
Comments are used to explain your code, and may help you when you edit the source code at a later date. Comments are ignored by browsers. A CSS comment begins with "/*", and ends with "*/", like this:

Selectors
In addition to setting a style for a HTML element, CSS allows you to specify your own selectors called "id" and "class".

The id Selector
The id selector is used to specify a style for a single, unique element. The id selector uses the id attribute of the HTML element, and is defined with a "#". The style rule below will be applied to the element with id="para1": Example #para1 { text-align:center; color:red; } Do NOT start an ID name with a number! It will not work in Mozilla/Firefox.

The class Selector


The class selector is used to specify a style for a group of elements. Unlike the id selector, the class selector is most often used on several elements. This allows you to set a particular style for many HTML elements with the same class. The class selector uses the HTML class attribute, and is defined with a "." In the example below, all HTML elements with class="center" will be center-aligned: Example center {text-align:center;} You can also specify that only specific HTML elements should be affected by a class. In the example below, all p elements with class="center" will be center-aligned: Example p.center {text-align:center;} Do NOT start a class name with a number! This is only supported in Internet Explorer.

In CSS, selectors are patterns used to select the element(s) you want to style. The "CSS" column indicates in which CSS version the property is defined (CSS1, CSS2, or CSS3). Selector .class Example .intro Example description Selects all elements with class="intro" .intro { background-color:yellow; } Selects the element with id="firstname" #firstname { background-color:yellow; } Selects all elements * { background-color:yellow; } Selects all <p> elements p { background-color:yellow; } Selects all <div> elements and all <p> elements h1,p { background-color:yellow; } Selects all <p> elements inside <div> elements Selects all <p> elements where the parent is a <div> element div p { background-color:yellow; } Selects all <p> elements that are placed immediately after <div> elements div+p { background-color:yellow; } Selects all elements with a target attribute a[target] { background-color:yellow; } Selects all elements with target="_blank" CSS 1

#id

#firstname

element

element, element

div,p

element element element>element

div p div>p

1 2

element+element

div+p

[attribute]

[target]

[attribute=value]

[target=_blank]

[attribute~=value]

[title~=flower]

[attribute|=value]

[lang|=en]

:link

a:link

:visited

a:visited

:active

a:active

:hover

a:hover

a[target=_blank] { background-color:yellow; } Selects all elements with a title attribute containing the word "flower" [title~=flower] { background-color:yellow; } Selects all elements with a lang attribute value starting with "en" [lang|=en] { background-color:yellow; } Selects all unvisited links a:link { background-color:yellow; } Selects all visited links a:visited { background-color:yellow; } Selects the active link a:active { background-color:yellow; } Selects links on mouse over a:hover { background-color:yellow; } Selects the input element which has focus input:focus { background-color:yellow; } Selects the first letter of every <p> element p:first-letter { font-size:200%; color:#8A2BE2; } Selects the first line of every <p> element p:first-line {

:focus

input:focus

:first-letter

p:first-letter

:first-line

p:first-line

background-color:yellow; } :first-child p:first-child Selects every <p> element that is the first child of its 2 parent p:first-child { background-color:yellow; } :before p:before Insert content before the content of every <p> 2 element p:before { content:"Read this: "; } :after p:after Insert content after every <p> element 2 p:after { content:"- Remember this"; } :lang(language) p:lang(it) Selects every <p> element with a lang attribute value 2 starting with "it" p:lang(it) { background:yellow; } element1~element2 p~ul Selects every <ul> element that are preceded by a 3 <p> element p~ul { background:#ff0000; } [attribute^=value] a[src^="https"] Selects every <a> element whose src attribute value 3 begins with "https" div[class^="test"] { background:#ffff00; } [attribute$=value] a[src$=".pdf"] Selects every <a> element whose src attribute value 3 ends with ".pdf" div[class$="test"] { background:#ffff00; } [attribute*=value] a[src*="w3schools"] Selects every <a> element whose src attribute value 3 contains the substring "w3schools" div[class*="test"] { background:#ffff00; } :first-of-type p:first-of-type Selects every <p> element that is the first <p> 3 element of its parent

p:first-of-type { background:#ff0000; } :last-of-type p:last-of-type Selects every <p> element that is the last <p> element of its parent p:last-of-type { background:#ff0000; } :only-of-type p:only-of-type Selects every <p> element that is the only <p> element of its parent p:only-of-type { background:#ff0000; } :only-child p:only-child Selects every <p> element that is the only child of its parent p:only-child { background:#ff0000; } :nth-child(n) p:nth-child(2) Selects every <p> element that is the second child of its parent p:nth-child(2) { background:#ff0000; } :nth-last-child(n) p:nth-last-child(2) Selects every <p> element that is the second child of its parent, counting from the last child p:nth-last-child(2) { background:#ff0000; } :nth-of-type(n) p:nth-of-type(2) Selects every <p> element that is the second <p> element of its parent p:nth-of-type(2) { background:#ff0000; } :nth-last-of-type(n) p:nth-last-of-type(2) Selects every <p> element that is the second <p> element of its parent, counting from the last child p:nth-last-of-type(2) { background:#ff0000; } :last-child p:last-child Selects every <p> element that is the last child of its parent p:last-child { background:#ff0000;

} :root :root Selects the documents root element :root { background:#ff0000; } Selects every <p> element that has no children (including text nodes) p:empty { background:#ff0000; } Selects the current active #news element (clicked on a URL containing that anchor name) :target:before { content: url(/images/lamp.gif); } Selects every enabled <input> element input[type="text"]:enabled { background:#ffff00; } Selects every disabled <input> element input[type="text"]:disabled { background:#dddddd; } Selects every checked <input> element input:checked { background:#ff0000; } Selects every element that is not a <p> element :not(p) { background:#ff0000; } 3

:empty

p:empty

:target

#news:target

:enabled

input:enabled

:disabled

input:disabled

:checked

input:checked

:not(selector)

:not(p)

::selection

::selection

Selects the portion of an element that is selected by 3 a user ::selection { color:#ff0000; } ::-moz-selection { color:#ff0000; }

CSS Properties
CSS Property Groups

Animation Background Border and outline Box Color Content Paged Media Dimension Flexible Box Font Generated content

Grid Hyperlink Linebox List Margin Marquee Multi-column Padding Paged Media Positioning

Print Ruby Speech Table Text 2D/3D Transform Transition User-interface

The "CSS" column indicates in which CSS version the property is defined (CSS1, CSS2, or CSS3).

Animation Properties
Property @keyframes animation animation-name animation-duration animation-timing-function animation-delay animation-iteration-count animation-direction animation-play-state Description Specifies the animation A shorthand property for all the animation properties below, except the animation-play-state property Specifies a name for the @keyframes animation Specifies how many seconds or milliseconds an animation takes to complete one cycle Specifies the speed curve of the animation Specifies when the animation will start Specifies the number of times an animation should be played Specifies whether or not the animation should play in reverse on alternate cycles Specifies whether the animation is running or paused CSS 3 3 3 3 3 3 3 3 3

Background Properties
Property background background-attachment background-color background-image background-position background-repeat background-clip Description Sets all the background properties in one declaration Sets whether a background image is fixed or scrolls with the rest of the page Sets the background color of an element Sets the background image for an element Sets the starting position of a background image Sets how a background image will be repeated Specifies the painting area of the background CSS 1 1 1 1 1 1 3

background-origin background-size

Specifies the positioning area of the background images Specifies the size of the background images

3 3

Border and Outline Properties


Property border border-bottom border-bottom-color border-bottom-style border-bottom-width border-color border-left border-left-color border-left-style border-left-width border-right border-right-color border-right-style border-right-width border-style border-top border-top-color border-top-style border-top-width border-width outline outline-color outline-style outline-width border-bottom-left-radius border-bottom-right-radius border-image border-image-outset border-image-repeat border-image-slice border-image-source border-image-width border-radius border-top-left-radius border-top-right-radius Description Sets all the border properties in one declaration Sets all the bottom border properties in one declaration Sets the color of the bottom border Sets the style of the bottom border Sets the width of the bottom border Sets the color of the four borders Sets all the left border properties in one declaration Sets the color of the left border Sets the style of the left border Sets the width of the left border Sets all the right border properties in one declaration Sets the color of the right border Sets the style of the right border Sets the width of the right border Sets the style of the four borders Sets all the top border properties in one declaration Sets the color of the top border Sets the style of the top border Sets the width of the top border Sets the width of the four borders Sets all the outline properties in one declaration Sets the color of an outline Sets the style of an outline Sets the width of an outline Defines the shape of the border of the bottom-left corner Defines the shape of the border of the bottom-right corner A shorthand property for setting all the border-image-* properties Specifies the amount by which the border image area extends beyond the border box Specifies whether the image-border should be repeated, rounded or stretched Specifies the inward offsets of the image-border Specifies an image to be used as a border Specifies the widths of the image-border A shorthand property for setting all the four border-*-radius properties Defines the shape of the border of the top-left corner Defines the shape of the border of the top-right corner CSS 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 2 2 2 2 3 3 3 3 3 3 3 3 3 3 3

box-decoration-break box-shadow

Attaches one or more drop-shadows to the box

3 3

Box Properties
Property overflow-x overflow-y overflow-style rotation rotation-point Description Specifies whether or not to clip the left/right edges of the content, if it overflows the element's content area Specifies whether or not to clip the top/bottom edges of the content, if it overflows the element's content area Specifies the preferred scrolling method for elements that overflow Rotates an element around a given point defined by the rotationpoint property Defines a point as an offset from the top left border edge CSS 3 3 3 3 3

Color Properties
Property color-profile opacity rendering-intent Description Permits the specification of a source color profile other than the default Sets the opacity level for an element Permits the specification of a color profile rendering intent other than the default CSS 3 3 3

Content for Paged Media Properties


Property bookmark-label bookmark-level bookmark-target float-offset hyphenate-after hyphenate-before hyphenate-character hyphenate-lines hyphenate-resource hyphens image-resolution marks Description Specifies the label of the bookmark Specifies the level of the bookmark Specifies the target of the bookmark link Pushes floated elements in the opposite direction of the where they have been floated with float Specifies the minimum number of characters in a hyphenated word after the hyphenation character Specifies the minimum number of characters in a hyphenated word before the hyphenation character Specifies a string that is shown when a hyphenate-break occurs Indicates the maximum number of successive hyphenated lines in an element Specifies a comma-separated list of external resources that can help the browser determine hyphenation points Sets how to split words to improve the layout of paragraphs Specifies the correct resolution of images Adds crop and/or cross marks to the document CSS 3 3 3 3 3 3 3 3 3 3 3 3

string-set

Dimension Properties
Property height max-height max-width min-height min-width width Description Sets the height of an element Sets the maximum height of an element Sets the maximum width of an element Sets the minimum height of an element Sets the minimum width of an element Sets the width of an element CSS 1 2 2 2 2 1

Flexible Box Properties


Property box-align box-direction box-flex box-flex-group box-lines box-ordinal-group box-orient box-pack Description Specifies how to align the child elements of a box Specifies in which direction the children of a box are displayed Specifies whether the children of a box is flexible or inflexible in size Assigns flexible elements to flex groups Specifies whether columns will go onto a new line whenever it runs out of space in the parent box Specifies the display order of the child elements of a box Specifies whether the children of a box should be laid out horizontally or vertically Specifies the horizontal position in horizontal boxes and the vertical position in vertical boxes CSS 3 3 3 3 3 3 3 3

Font Properties
Property font font-family font-size font-style font-variant font-weight @font-face font-size-adjust font-stretch Description Sets all the font properties in one declaration Specifies the font family for text Specifies the font size of text Specifies the font style for text Specifies whether or not a text should be displayed in a smallcaps font Specifies the weight of a font A rule that allows websites to download and use fonts other than the "web-safe" fonts Preserves the readability of text when font fallback occurs Selects a normal, condensed, or expanded face from a font family CSS 1 1 1 1 1 1 3 3 3

Generated Content Properties


Property content counter-increment counter-reset quotes crop move-to page-policy Description Used with the :before and :after pseudo-elements, to insert generated content Increments one or more counters Creates or resets one or more counters Sets the type of quotation marks for embedded quotations Allows a replaced element to be just a rectangular area of an object, instead of the whole object Causes an element to be removed from the flow and reinserted at a later point in the document Determines which page-based occurance of a given element is applied to a counter or string value CSS 2 2 2 2 3 3 3

Grid Properties
Property grid-columns grid-rows Description Specifies the width of each column in a grid Specifies the height of each column in a grid CSS 3 3

Hyperlink Properties
Property target target-name target-new target-position Description A shorthand property for setting the target-name, target-new, and target-position properties Specifies where to open links (target destination) Specifies whether new destination links should open in a new window or in a new tab of an existing window Specifies where new destination links should be placed CSS 3 3 3 3

Linebox Properties
Property alignment-adjust alignment-baseline baseline-shift dominant-baseline drop-initial-after-adjust drop-initial-after-align drop-initial-before-adjust Description Allows more precise alignment of elements Specifies how an inline-level element is aligned with respect to its parent Allows repositioning of the dominant-baseline relative to the dominant-baseline Specifies a scaled-baseline-table Sets the alignment point of the drop initial for the primary connection point Sets which alignment line within the initial line box is used at the primary connection point with the initial letter box Sets the alignment point of the drop initial for the secondary CSS 3 3 3 3 3 3 3

drop-initial-before-align drop-initial-size drop-initial-value inline-box-align line-stacking line-stacking-ruby line-stacking-shift line-stacking-strategy text-height

connection point Sets which alignment line within the initial line box is used at the secondary connection point with the initial letter box Controls the partial sinking of the initial letter Activates a drop-initial effect Sets which line of a multi-line inline block align with the previous and next inline elements within a line A shorthand property for setting the line-stacking-strategy, linestacking-ruby, and line-stacking-shift properties Sets the line stacking method for block elements containing ruby annotation elements Sets the line stacking method for block elements containing elements with base-shift Sets the line stacking strategy for stacked line boxes within a containing block element Sets the block-progression dimension of the text content area of an inline box

3 3 3 3 3 3 3 3 3

List Properties
Property list-style list-style-image list-style-position list-style-type Description Sets all the properties for a list in one declaration Specifies an image as the list-item marker Specifies if the list-item markers should appear inside or outside the content flow Specifies the type of list-item marker CSS 1 1 1 1

Margin Properties
Property margin margin-bottom margin-left margin-right margin-top Description Sets all the margin properties in one declaration Sets the bottom margin of an element Sets the left margin of an element Sets the right margin of an element Sets the top margin of an element CSS 1 1 1 1 1

Marquee Properties
Property marquee-direction marquee-play-count marquee-speed marquee-style Description Sets the direction of the moving content Sets how many times the content move Sets how fast the content scrolls Sets the style of the moving content CSS 3 3 3 3

Multi-column Properties
Property column-count column-fill column-gap column-rule column-rule-color column-rule-style column-rule-width column-span column-width columns Description Specifies the number of columns an element should be divided into Specifies how to fill columns Specifies the gap between the columns A shorthand property for setting all the column-rule-* properties Specifies the color of the rule between columns Specifies the style of the rule between columns Specifies the width of the rule between columns Specifies how many columns an element should span across Specifies the width of the columns A shorthand property for setting column-width and column-count CSS 3 3 3 3 3 3 3 3 3 3

Padding Properties
Property padding padding-bottom padding-left padding-right padding-top Description Sets all the padding properties in one declaration Sets the bottom padding of an element Sets the left padding of an element Sets the right padding of an element Sets the top padding of an element CSS 1 1 1 1 1

Paged Media Properties


Property fit fit-position image-orientation page size Description Gives a hint for how to scale a replaced element if neither its width nor its height property is auto Determines the alignment of the object inside the box Specifies a rotation in the right or clockwise direction that a user agent applies to an image Specifies a particular type of page where an element SHOULD be displayed Specifies the size and orientation of the containing box for page content CSS 3 3 3 3 3

Positioning Properties
Property bottom clear clip Description Specifies the bottom position of a positioned element Specifies which sides of an element where other floating elements are not allowed Clips an absolutely positioned element CSS 2 1 2

cursor display float left overflow position right top visibility z-index

Specifies the type of cursor to be displayed Specifies how a certain HTML element should be displayed Specifies whether or not a box should float Specifies the left position of a positioned element Specifies what happens if content overflows an element's box Specifies the type of positioning method used for an element (static, relative, absolute or fixed) Specifies the right position of a positioned element Specifies the top position of a positioned element Specifies whether or not an element is visible Sets the stack order of a positioned element

2 1 1 2 2 2 2 2 2 2

Print Properties
Property orphans page-break-after page-break-before page-break-inside widows Description Sets the minimum number of lines that must be left at the bottom of a page when a page break occurs inside an element Sets the page-breaking behavior after an element Sets the page-breaking behavior before an element Sets the page-breaking behavior inside an element Sets the minimum number of lines that must be left at the top of a page when a page break occurs inside an element CSS 2 2 2 2 2

Ruby Properties
Property ruby-align ruby-overhang Description Controls the text alignment of the ruby text and ruby base contents relative to each other Determines whether, and on which side, ruby text is allowed to partially overhang any adjacent text in addition to its own base, when the ruby text is wider than the ruby base Controls the position of the ruby text with respect to its base Controls the spanning behavior of annotation elements CSS 3 3

ruby-position ruby-span

3 3

Speech Properties
Property mark mark-after mark-before phonemes rest Description A shorthand property for setting the mark-before and mark-after properties Allows named markers to be attached to the audio stream Allows named markers to be attached to the audio stream Specifies a phonetic pronunciation for the text contained by the corresponding element A shorthand property for setting the rest-before and rest-after properties CSS 3 3 3 3 3

rest-after rest-before voice-balance voice-duration voice-pitch voice-pitch-range voice-rate voice-stress voice-volume

Specifies a rest or prosodic boundary to be observed after speaking an element's content Specifies a rest or prosodic boundary to be observed before speaking an element's content Specifies the balance between left and right channels Specifies how long it should take to render the selected element's content Specifies the average pitch (a frequency) of the speaking voice Specifies variation in average pitch Controls the speaking rate Indicates the strength of emphasis to be applied Refers to the amplitude of the waveform output by the speech synthesises

3 3 3 3 3 3 3 3 3

Table Properties
Property border-collapse border-spacing caption-side empty-cells table-layout Description Specifies whether or not table borders should be collapsed Specifies the distance between the borders of adjacent cells Specifies the placement of a table caption Specifies whether or not to display borders and background on empty cells in a table Sets the layout algorithm to be used for a table CSS 2 2 2 2 2

Text Properties
Property color direction letter-spacing line-height text-align text-decoration text-indent text-transform unicode-bidi vertical-align white-space word-spacing hanging-punctuation punctuation-trim text-align-last Description Sets the color of text Specifies the text direction/writing direction Increases or decreases the space between characters in a text Sets the line height Specifies the horizontal alignment of text Specifies the decoration added to text Specifies the indentation of the first line in a text-block Controls the capitalization of text CSS 1 2 1 1 1 1 1 1 2 Sets the vertical alignment of an element 1 Specifies how white-space inside an element is handled 1 Increases or decreases the space between words in a text 1 Specifies whether a punctuation character may be placed outside 3 the line box Specifies whether a punctuation character should be trimmed 3 Describes how the last line of a block or a line right before a 3 forced line break is aligned when text-align is "justify"

text-justify text-outline text-overflow text-shadow text-wrap word-break word-wrap

Specifies the justification method used when text-align is "justify" Specifies a text outline Specifies what should happen when text overflows the containing element Adds shadow to text Specifies line breaking rules for text Specifies line breaking rules for non-CJK scripts Allows long, unbreakable words to be broken and wrap to the next line

3 3 3 3 3 3 3

2D/3D Transform Properties


Property transform transform-origin transform-style perspective perspective-origin backface-visibility Description Applies a 2D or 3D transformation to an element Allows you to change the position on transformed elements Specifies how nested elements are rendered in 3D space Specifies the perspective on how 3D elements are viewed Specifies the bottom position of 3D elements Defines whether or not an element should be visible when not facing the screen CSS 3 3 3 3 3 3

Transition Properties
Property transition transition-property transition-duration transition-timing-function transition-delay Description A shorthand property for setting the four transition properties Specifies the name of the CSS property the transition effect is for Specifies how many seconds or milliseconds a transition effect takes to complete Specifies the speed curve of the transition effect Specifies when the transition effect will start CSS 3 3 3 3 3

User-interface Properties
Property appearance box-sizing icon nav-down nav-index nav-left Description Allows you to make an element look like a standard user interface element Allows you to define certain elements to fit an area in a certain way Provides the author the ability to style an element with an iconic equivalent Specifies where to navigate when using the arrow-down navigation key Specifies the tabbing order for an element Specifies where to navigate when using the arrow-left navigation key CSS 3 3 3 3 3 3

nav-right nav-up outline-offset resize

Specifies where to navigate when using the arrow-right navigation key Specifies where to navigate when using the arrow-up navigation key Offsets an outline, and draws it beyond the border edge Specifies whether or not an element is resizable by the user

3 3 3 3

CSS Aural Reference


Aural Style Sheets
Aural style sheets use a combination of speech synthesis and sound effects to make the user listen to information, instead of reading information. Aural presentation can be used: by blind people to help users learning to read to help users who have reading problems for home entertainment in the car by print-impaired communities The aural presentation converts the document to plain text and feed this to a screen reader (a program that reads all the characters on the screen). An example of an Aural style sheet: h1,h2,h3,h4 { voice-family:male; richness:80; cue-before:url("beep.au") } The example above will make the speech synthesizer play a sound, then speak the headers in a very rich male voice.

CSS Aural Reference


The "CSS" column indicates in which CSS version the property is defined (CSS1 or CSS2). Property
azimuth

Description
Sets where the sound should come from

Values
angle left-side far-left left center-left center center-right right far-right right-side behind leftwards rightwards cue-before cue-after none url none url angle below level

CSS
2

cue cue-after cue-before elevation

Sets the cue properties in one declaration Specifies a sound to be played after speaking an element's content Specifies a sound to be played before speaking an element's content Sets where the sound should come from

2 2 2 2

pause pause-after pause-before pitch

Sets the pause properties in one declaration Specifies a pause after speaking an element's content Specifies a pause before speaking an element's content Specifies the speaking voice

pitch-range play-during

Specifies the variation in the speaking voice. (Monotone voice or animated voice?) Specifies a sound to be played while speaking an element's content

above higher lower pause-before pause-after time % time % frequency x-low low medium high x-high number

2 2 2 2

2 2

richness speak

speak-header

speak-numeral speak-punctuation speech-rate

stress voice-family volume

auto none url mix repeat Specifies the richness of the speaking voice. (Rich voice number or thin voice?) Specifies whether content will render aurally normal none spell-out Specifies how to handle table headers. Should the always headers be spoken before every cell, or only before a cell once with a different header than the previous cell Specifies how to speak numbers digits continuous Specifies how to speak punctuation characters none code Specifies the speed of the speaking number x-slow slow medium fast x-fast faster slower Specifies the "stress" in the speaking voice number Specifies the voice family of the speaking specific-voice generic-voice Specifies the volume of the speaking number % silent x-soft soft medium loud x-loud

2 2

2 2 2

2 2 2

CSS Web Safe Font Combinations


Commonly Used Font Combinations
The font-family property should hold several font names as a "fallback" system, to ensure maximum compatibility between browsers/operating systems. If the browser does not support the first font, it tries the next font. Start with the font you want, and end with a generic family, to let the browser pick a similar font in the generic family, if no other fonts are available: Example p{font-family:"Times New Roman", Times, serif} Try it yourself Below are some commonly used font combinations, organized by generic family.

Serif Fonts
font-family Georgia, serif "Palatino Linotype", "Book Antiqua", Palatino, serif Example text

This is a heading
This is a paragraph

This is a heading
This is a paragraph

"Times New Roman", Times, serif

This is a heading
This is a paragraph
Example text

Sans-Serif Fonts
font-family Arial, Helvetica, sans-serif "Arial Black", Gadget, sans-serif

This is a heading
This is a paragraph

This is a heading
This is a paragraph

"Comic Sans MS", cursive, sans-serif

This is a heading
This is a paragraph

Impact, Charcoal, sans-serif

This is a heading
This is a paragraph

"Lucida Sans Unicode", "Lucida Grande", sans-serif

This is a heading
This is a paragraph

Tahoma, Geneva, sans-serif

This is a heading
This is a paragraph

"Trebuchet MS", Helvetica, sans-serif

This is a heading

This is a paragraph
Verdana, Geneva, sans-serif

This is a heading
This is a paragraph
Example text

Monospace Fonts
font-family "Courier New", Courier, monospace "Lucida Console", Monaco, monospace

This is a heading
This is a paragraph

This is a heading
This is a paragraph

CSS Units
Measurement Values
Unit % in cm mm em Description percentage inch centimeter millimeter 1em is equal to the current font size. 2em means 2 times the size of the current font. E.g., if an element is displayed with a font of 12 pt, then '2em' is 24 pt. The 'em' is a very useful unit in CSS, since it can adapt automatically to the font that the reader uses one ex is the x-height of a font (x-height is usually about half the font-size) point (1 pt is the same as 1/72 inch) pica (1 pc is the same as 12 points) pixels (a dot on the computer screen)

ex pt pc px

CSS Legal Color Values


CSS Colors
Colors in CSS can be specified by the following methods: Hexadecimal colors RGB colors RGBA colors HSL colors HSLA colors Predefined/Cross-browser color names

Hexadecimal Colors
Hexadecimal color values are supported in all major browsers. A hexadecimal color is specified with: #RRGGBB, where the RR (red), GG (green) and BB (blue) hexadecimal integers specify the components of the color. All values must be between 0 and FF. For example, the #0000ff value is rendered as blue, because the blue component is set to its highest value (ff) and the others are set to 0. Example p { background-color:#ff0000; } Try it yourself

RGB Colors
RGB color values are supported in all major browsers. An RGB color value is specified with: rgb(red, green, blue). Each parameter (red, green, and blue) defines the intensity of the color and can be an integer between 0 and 255 or a percentage value (from 0% to 100%). For example, the rgb(0,0,255) value is rendered as blue, because the blue parameter is set to its highest value (255) and the others are set to 0. Also, the following values define the same color: rgb(0,0,255) and rgb(0%,0%,100%). Example p { background-color:rgb(255,0,0); } Try it yourself

RGBA Colors
RGBA color values are supported in IE9+, Firefox 3+, Chrome, Safari, and in Opera 10+. RGBA color values are an extension of RGB color values with an alpha channel - which specifies the opacity of the object.

An RGBA color value is specified with: rgba(red, green, blue, alpha). The alpha parameter is a number between 0.0 (fully transparent) and 1.0 (fully opaque). Example p { background-color:rgba(255,0,0,0.5); } Try it yourself

HSL Colors
HSL color values are supported in IE9+, Firefox, Chrome, Safari, and in Opera 10+. HSL stands for hue, saturation, and lightness - and represents a cylindrical-coordinate representation of colors. An HSL color value is specified with: hsl(hue, saturation, lightness). Hue is a degree on the color wheel (from 0 to 360) - 0 (or 360) is red, 120 is green, 240 is blue. Saturation is a percentage value; 0% means a shade of gray and 100% is the full color. Lightness is also a percentage; 0% is black, 100% is white. Example p { background-color:hsl(120,65%,75%); } Try it yourself

HSLA Colors
HSLA color values are supported in IE9+, Firefox 3+, Chrome, Safari, and in Opera 10+. HSLA color values are an extension of HSL color values with an alpha channel - which specifies the opacity of the object. An HSLA color value is specified with: hsla(hue, saturation, lightness, alpha), where the alpha parameter defines the opacity. The alpha parameter is a number between 0.0 (fully transparent) and 1.0 (fully opaque). Example p { background-color:hsla(120,65%,75%,0.3); } Try it yourself

CSS Colors HEX Values


Sorted by HEX Value
Color Name Black Navy HEX #000000 #000080 Color Shades Shades Shades Mix Mix Mix

DarkBlue MediumBlue Blue DarkGreen Green Teal DarkCyan DeepSkyBlue DarkTurquoise MediumSpringGreen Lime SpringGreen Aqua Cyan MidnightBlue DodgerBlue LightSeaGreen ForestGreen SeaGreen DarkSlateGray DarkSlateGrey LimeGreen MediumSeaGreen Turquoise RoyalBlue SteelBlue DarkSlateBlue MediumTurquoise Indigo DarkOliveGreen CadetBlue CornflowerBlue MediumAquaMarine DimGray DimGrey SlateBlue OliveDrab SlateGray SlateGrey LightSlateGray LightSlateGrey MediumSlateBlue LawnGreen Chartreuse

#00008B #0000CD #0000FF #006400 #008000 #008080 #008B8B #00BFFF #00CED1 #00FA9A #00FF00 #00FF7F #00FFFF #00FFFF #191970 #1E90FF #20B2AA #228B22 #2E8B57 #2F4F4F #2F4F4F #32CD32 #3CB371 #40E0D0 #4169E1 #4682B4 #483D8B #48D1CC #4B0082 #556B2F #5F9EA0 #6495ED #66CDAA #696969 #696969 #6A5ACD #6B8E23 #708090 #708090 #778899 #778899 #7B68EE #7CFC00 #7FFF00

Shades Shades Shades Shades Shades Shades Shades Shades Shades Shades Shades Shades Shades Shades Shades Shades Shades Shades Shades Shades Shades Shades Shades Shades Shades Shades Shades Shades Shades Shades Shades Shades Shades Shades Shades Shades Shades Shades Shades Shades Shades Shades Shades Shades

Mix Mix Mix Mix Mix Mix Mix Mix Mix Mix Mix Mix Mix Mix Mix Mix Mix Mix Mix Mix Mix Mix Mix Mix Mix Mix Mix Mix Mix Mix Mix Mix Mix Mix Mix Mix Mix Mix Mix Mix Mix Mix Mix Mix

Aquamarine Maroon Purple Olive Gray Grey SkyBlue LightSkyBlue BlueViolet DarkRed DarkMagenta SaddleBrown DarkSeaGreen LightGreen MediumPurple DarkViolet PaleGreen DarkOrchid YellowGreen Sienna Brown DarkGray DarkGrey LightBlue GreenYellow PaleTurquoise LightSteelBlue PowderBlue FireBrick DarkGoldenRod MediumOrchid RosyBrown DarkKhaki Silver MediumVioletRed IndianRed Peru Chocolate Tan LightGray LightGrey Thistle Orchid GoldenRod

#7FFFD4 #800000 #800080 #808000 #808080 #808080 #87CEEB #87CEFA #8A2BE2 #8B0000 #8B008B #8B4513 #8FBC8F #90EE90 #9370DB #9400D3 #98FB98 #9932CC #9ACD32 #A0522D #A52A2A #A9A9A9 #A9A9A9 #ADD8E6 #ADFF2F #AFEEEE #B0C4DE #B0E0E6 #B22222 #B8860B #BA55D3 #BC8F8F #BDB76B #C0C0C0 #C71585 #CD5C5C #CD853F #D2691E #D2B48C #D3D3D3 #D3D3D3 #D8BFD8 #DA70D6 #DAA520

Shades Shades Shades Shades Shades Shades Shades Shades Shades Shades Shades Shades Shades Shades Shades Shades Shades Shades Shades Shades Shades Shades Shades Shades Shades Shades Shades Shades Shades Shades Shades Shades Shades Shades Shades Shades Shades Shades Shades Shades Shades Shades Shades Shades

Mix Mix Mix Mix Mix Mix Mix Mix Mix Mix Mix Mix Mix Mix Mix Mix Mix Mix Mix Mix Mix Mix Mix Mix Mix Mix Mix Mix Mix Mix Mix Mix Mix Mix Mix Mix Mix Mix Mix Mix Mix Mix Mix Mix

PaleVioletRed Crimson Gainsboro Plum BurlyWood LightCyan Lavender DarkSalmon Violet PaleGoldenRod LightCoral Khaki AliceBlue HoneyDew Azure SandyBrown Wheat Beige WhiteSmoke MintCream GhostWhite Salmon AntiqueWhite Linen LightGoldenRodYellow OldLace Red Fuchsia Magenta DeepPink OrangeRed Tomato HotPink Coral Darkorange LightSalmon Orange LightPink Pink Gold PeachPuff NavajoWhite Moccasin Bisque

#DB7093 #DC143C #DCDCDC #DDA0DD #DEB887 #E0FFFF #E6E6FA #E9967A #EE82EE #EEE8AA #F08080 #F0E68C #F0F8FF #F0FFF0 #F0FFFF #F4A460 #F5DEB3 #F5F5DC #F5F5F5 #F5FFFA #F8F8FF #FA8072 #FAEBD7 #FAF0E6 #FAFAD2 #FDF5E6 #FF0000 #FF00FF #FF00FF #FF1493 #FF4500 #FF6347 #FF69B4 #FF7F50 #FF8C00 #FFA07A #FFA500 #FFB6C1 #FFC0CB #FFD700 #FFDAB9 #FFDEAD #FFE4B5 #FFE4C4

Shades Shades Shades Shades Shades Shades Shades Shades Shades Shades Shades Shades Shades Shades Shades Shades Shades Shades Shades Shades Shades Shades Shades Shades Shades Shades Shades Shades Shades Shades Shades Shades Shades Shades Shades Shades Shades Shades Shades Shades Shades Shades Shades Shades

Mix Mix Mix Mix Mix Mix Mix Mix Mix Mix Mix Mix Mix Mix Mix Mix Mix Mix Mix Mix Mix Mix Mix Mix Mix Mix Mix Mix Mix Mix Mix Mix Mix Mix Mix Mix Mix Mix Mix Mix Mix Mix Mix Mix

MistyRose BlanchedAlmond PapayaWhip LavenderBlush SeaShell Cornsilk LemonChiffon FloralWhite Snow Yellow LightYellow Ivory White

#FFE4E1 #FFEBCD #FFEFD5 #FFF0F5 #FFF5EE #FFF8DC #FFFACD #FFFAF0 #FFFAFA #FFFF00 #FFFFE0 #FFFFF0 #FFFFFF

Shades Shades Shades Shades Shades Shades Shades Shades Shades Shades Shades Shades Shades

Mix Mix Mix Mix Mix Mix Mix Mix Mix Mix Mix Mix Mix

You might also like