Top Banner
CSS3 implementing the new features Mark Branom, IT Services John Foliot, Stanford Online Accessibility Program
37

Implementing the new features Mark Branom, IT Services John Foliot, Stanford Online Accessibility Program.

Dec 23, 2015

Download

Documents

Regina Sanders
Welcome message from author
This document is posted to help you gain knowledge. Please leave a comment to let me know what you think about it! Share it to your friends and learn new things together.
Transcript
Page 1: Implementing the new features Mark Branom, IT Services John Foliot, Stanford Online Accessibility Program.

CSS3implementing the new features

Mark Branom, IT ServicesJohn Foliot, Stanford Online Accessibility

Program

Page 2: Implementing the new features Mark Branom, IT Services John Foliot, Stanford Online Accessibility Program.

Brief history… 1997-2001

Content: HTML 4.01 Presentation: CSS1

Page 3: Implementing the new features Mark Branom, IT Services John Foliot, Stanford Online Accessibility Program.

Brief history… 2001-2006

Content: XHTML 1 Presentation: CSS2

Page 4: Implementing the new features Mark Branom, IT Services John Foliot, Stanford Online Accessibility Program.

Brief history… 2007-present

Content: HTML5 Presentation: CSS3

Page 5: Implementing the new features Mark Branom, IT Services John Foliot, Stanford Online Accessibility Program.

Vendor Prefixes

Some CSS rules won’t work without the vendor prefix. Mozilla Browsers (Firefox)

-moz

Webkit Browsers (Safari, Chrome)-webkit

Opera-o

Internet Explorer-ms<!--[if IE]> <![endif]-->

Not all CSS rules work with all browsers: http://www.caniuse.com/ http://www.css3.info/selectors-test/ http://quirksmode.org/css/contents.html

Page 6: Implementing the new features Mark Branom, IT Services John Foliot, Stanford Online Accessibility Program.

So, what’s the big deal about CSS3?

Page 7: Implementing the new features Mark Branom, IT Services John Foliot, Stanford Online Accessibility Program.

New selectors!

element1~element2Selects an element that is a general next sibling of another element.

Example:http://www.quirksmode.org/css/selector_sibling.html

[attribute^=value] Represents an element with the attribute whose value begins with the prefix value.

[attribute$=value] Represents an element with the attribute whose value ends with the prefix value.

[attribute*=value] Represents an element with the attribute whose value contains the prefix value.

Example:http://www.quirksmode.org/css/selector_attributeAdvanced.html

Page 8: Implementing the new features Mark Branom, IT Services John Foliot, Stanford Online Accessibility Program.

New pseudo elements/classes!

:first-of-type :last-of-type :only-of-type

Select elements that are first, last, or only child of its type of its parent

Example:http://www.quirksmode.org/css/type.html

:first-child :only-child :last-child

Selects an element that is the first, only, or last child of its parent.

Examples:http://www.quirksmode.org/css/firstchild.htmlhttp://www.quirksmode.org/css/onlychild.html

Page 9: Implementing the new features Mark Branom, IT Services John Foliot, Stanford Online Accessibility Program.

More new pseudo elements/classes! nth-child(n) :nth-of-type(n)

Allows you to select elements with a formula. Example:

http://www.quirksmode.org/css/nthchild.html

:nth-last-child(n) :nth-last-of-type(n)

Work same as nth-child, except that they start counting at the last element instead of the first. Example:

http://www.quirksmode.org/css/nthlastchild.html

:root Selects the root initial containing block (in HTML, this is the <html> tag) Example:

http://www.quirksmode.org/css/root.html

:empty Selects elements with no content (“empty”). Example:

http://www.quirksmode.org/css/empty.html

:target Selects a targeted element – one with an ID with the same value as the URL's hash. Example:

http://www.quirksmode.org/css/target.htmlhttp://www.quirksmode.org/css/target.html#testHash

Page 10: Implementing the new features Mark Branom, IT Services John Foliot, Stanford Online Accessibility Program.

Still more new pseudo elements/classes!

:enabled :disabled :checked

Allows a designer to apply style to enabled, disabled, or checked form field elements.

Example:http://www.quirksmode.org/css/enabled.html

:not(selector) Negates a selector. Example:

http://www.quirksmode.org/css/not.html

::selection Defines style for text that a user selects. Example:

http://www.quirksmode.org/css/selection.html

Page 11: Implementing the new features Mark Branom, IT Services John Foliot, Stanford Online Accessibility Program.

New properties! (and some new 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

CSS Property Groups:

Page 12: Implementing the new features Mark Branom, IT Services John Foliot, Stanford Online Accessibility Program.

Animation

@keyframesSpecifies the animation

animation A shorthand property for all the animation properties below, except the animation-play-state property

animation-nameSpecifies a name for the @keyframes animation

animation-duration Specifies how many seconds or milliseconds an animation takes to complete one cycle

animation-timing-functionSpecifies the speed curve of the animation

animation-delay Specifies when the animation will start

animation-iteration-count Specifies the number of times an animation should be played

animation-directionSpecifies whether or not the animation should play in reverse on alternate cycles

animation-play-stateSpecifies whether the animation is running or paused

Examples:http://www.leemunroe.com/css3-animations/http://css3.bradshawenterprises.com/animations/http://www.w3schools.com/css3/tryit.asp?filename=trycss3_animation1http://www.standardista.com/sxsw/#slide24

Page 13: Implementing the new features Mark Branom, IT Services John Foliot, Stanford Online Accessibility Program.

Transition

transition A shorthand property for setting the four transition properties

transition-property Specifies the name of the CSS property the transition effect is for

transition-duration Specifies how many seconds or milliseconds a transition effect takes to complete

transition-timing-function Specifies the speed curve of the transition effect

transition-delay Specifies when the transition effect will start

Example:http://css3.bradshawenterprises.com/transitions/

Page 14: Implementing the new features Mark Branom, IT Services John Foliot, Stanford Online Accessibility Program.

Transform

transform Applies a 2D or 3D transformation to an element

transform-origin Allows you to change the position on transformed elements

transform-style Specifies how nested elements are rendered in 3D space

perspective Specifies the perspective on how 3D elements are viewed

perspective-origin Specifies the bottom position of 3D elements

backface-visibility Defines whether or not an element should be visible when not facing the screen

Examples:http://westciv.com/tools/3Dtransforms/index.htmlhttp://css3.bradshawenterprises.com/transforms/

Page 15: Implementing the new features Mark Branom, IT Services John Foliot, Stanford Online Accessibility Program.

Background

background-clip Specifies the painting area of the background

background-origin Specifies the positioning area of the background images

background-sizeSpecifies the size of the background images Example:

http://www.css3.info/preview/background-origin-and-background-clip/

background-gradientSpecifies a gradient (shifting from one color to another) in the background Examples:

http://www.stanford.edu/group/ttsclasses/cgi-bin/techietips/?p=485http://css-tricks.com/5700-css3-gradients/http://www.standardista.com/sxsw/#slide3

Page 16: Implementing the new features Mark Branom, IT Services John Foliot, Stanford Online Accessibility Program.

Border

border-bottom-left-radius Defines the shape of the border of the bottom-left corner

border-bottom-right-radius Defines the shape of the border of the bottom-right corner

border-image A shorthand property for setting all the border-image-* properties

border-image-outset Specifies the amount by which the border image area extends beyond the border box

border-image-repeat Specifies whether the image-border should be repeated, rounded or stretched

border-image-slice Specifies the inward offsets of the image-border

border-image-source Specifies an image to be used as a border

border-image-width Specifies the widths of the image-border

border-radius A shorthand property for setting all the four border-*-radius properties

border-top-left-radius Defines the shape of the border of the top-left corner

border-top-right-radius Defines the shape of the border of the top-right corner

Examples:http://www.css3.info/preview/rounded-border/http://border-radius.com/

Page 17: Implementing the new features Mark Branom, IT Services John Foliot, Stanford Online Accessibility Program.

Box

box-decoration-break Defines a break in the box’s decoration Example: http://www.w3.org/TR/css3-background/#the-box-decoration-break

box-shadow

Attaches one or more drop-shadows to the box Examples:

http://www.css3.info/preview/box-shadow/http://www.standardista.com/sxsw/#slide9

overflow-x Specifies whether or not to clip the left/right edges of the content, if it overflows the element's content area

overflow-y Specifies whether or not to clip the top/bottom edges of the content, if it overflows the element's content area

overflow-style Specifies the preferred scrolling method for elements that overflow Example: http://www.css3.info/overflow-xoverflow-y

Page 18: Implementing the new features Mark Branom, IT Services John Foliot, Stanford Online Accessibility Program.

Flexible Box

Specification is still under development…Stay Tuned!!!

Example:http://www.html5rocks.com/en/tutorials/flexbox/quick/

Page 19: Implementing the new features Mark Branom, IT Services John Foliot, Stanford Online Accessibility Program.

Color

RGBA(Red,Green,Blue,Alpha opacity)rgba(100%,0%,0%,0.8) produces 80% red. Examples:

http://www.css3.info/preview/rgba/http://hex2rgba.devoth.com/

HSLA (Hue, Saturation, Lightness, Alpha opacity)hsla(0,100%, 50%,1.0) produces 100% red. Examples:

http://hslpicker.com/http://www.css3.info/preview/hsl/

opacity Sets the opacity level for an element from 0 to 1.0. Example:

http://www.css3.info/preview/opacity/http://www.standardista.com/sxsw/#slide6

Page 20: Implementing the new features Mark Branom, IT Services John Foliot, Stanford Online Accessibility Program.

Font

Free web fonts:http://www.google.com/webfontshttp://www.fontsquirrel.com

@font-face A rule that allows websites to download and use fonts other than the "web-safe" fonts Examples:

http://css-tricks.com/snippets/css/using-font-face/http://www.css3.info/preview/web-fonts-with-font-face/

font-size-adjust Preserves the readability of text when font fallback occurs Example:

http://www.w3.org/TR/css3-fonts/#font-size-adjust-prop

font-stretch Selects a normal, condensed, or expanded face from a font family Example: Currently no browser supports font-stretch

Page 21: Implementing the new features Mark Branom, IT Services John Foliot, Stanford Online Accessibility Program.

Text

hanging-punctuation Specifies whether a punctuation character may be placed outside the line box Example: Currently no browser supports hanging-punctuation

punctuation-trim Specifies whether a punctuation character should be trimmed Example: Currently no browser supports punctuation-trim

text-outline Specifies a text outline Example: Currently no browser supports text-outline

text-wrap Specifies line breaking rules for text Example: Currently no browser supports text-wrap

text-align-last Describes how the last line of a block or a line right before a forced line break is aligned when text-align is "justify" Example:

http://msdn.microsoft.com/en-us/library/ms531163(VS.85).aspx

Page 22: Implementing the new features Mark Branom, IT Services John Foliot, Stanford Online Accessibility Program.

Text (continued)

text-justify Specifies the justification method used when text-align is "justify" Example:

http://msdn.microsoft.com/en-us/library/ms531172(v=VS.85).aspx text-shadow

Adds shadow to text Examples:

http://www.css3.info/preview/text-shadow/http://www.quirksmode.org/css/textshadow.htmlhttp://www.standardista.com/sxsw/#slide9

word-break Specifies line breaking rules for non-CJK (Chinese/Japanese/Korean) text Example:

http://www.w3schools.com/cssref/tryit.asp?filename=trycss3_word-break word-wrap

Allows long, unbreakable words to be broken and wrap to the next line Example:

http://www.css3.info/preview/word-wrap/

Page 23: Implementing the new features Mark Branom, IT Services John Foliot, Stanford Online Accessibility Program.

Grid

grid-columns Specifies the width of each column in a grid

grid-rowsSpecifies the height of each column in a grid

Examples:http://dev.w3.org/csswg/css3-grid-align

http://www.xanthir.com/blog/b4580

Page 24: Implementing the new features Mark Branom, IT Services John Foliot, Stanford Online Accessibility Program.

Multi-column

column-count Specifies the number of columns an element should be divided into

column-fill Specifies how to fill columns

column-gap Specifies the gap between the columns

column-rule A shorthand property for setting all the column-rule-* properties

column-rule-color Specifies the color of the rule between columns

column-rule-style Specifies the style of the rule between columns

column-rule-width Specifies the width of the rule between columns

column-span Specifies how many columns an element should span across

column-width Specifies the width of the columns

columns A shorthand property for setting column-width and column-count

Examples:http://www.quirksmode.org/css/multicolumn.htmlhttp://www.css3.info/preview/multi-column-layout/

Page 25: Implementing the new features Mark Branom, IT Services John Foliot, Stanford Online Accessibility Program.

Marquee

marquee-direction Sets the direction of the moving content

marquee-play-count Sets how many times the content move

marquee-speedSets how fast the content scrolls

marquee-style Sets the style of the moving content

Examples:http://www.css3.info/modules/css3-marquee-module/

http://www.cssplay.co.uk/menu/css3-marquee.html

Page 26: Implementing the new features Mark Branom, IT Services John Foliot, Stanford Online Accessibility Program.

Ruby

ruby-align Controls the text alignment of the ruby text and ruby base contents relative to each other

ruby-overhang 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

ruby-positionControls the position of the ruby text with respect to its base

ruby-spanControls the spanning behavior of annotation elements

Examples:http://www.w3.org/TR/css3-rubyhttp://www.storiesinflight.com/html5/ruby.html

Page 27: Implementing the new features Mark Branom, IT Services John Foliot, Stanford Online Accessibility Program.

User-Interface

appearance Makes any element appear like a form element (e.g., paragraphs can look like buttons). Examples:

https://developer.mozilla.org/en/CSS/-moz-appearancehttp://davidwalsh.name/dw-content/webkit-styles.php

box-sizing Forces an element fit inside an area. Example:

http://css-tricks.com/examples/BoxSizing/

outline-offset Offsets an outline, and draws it beyond the border edge Example:

http://www.w3schools.com/cssref/tryit.asp?filename=trycss3_outline-offset

resize Specifies whether or not an element is resizable by the user Example:

http://www.css3.info/preview/resize/

Page 28: Implementing the new features Mark Branom, IT Services John Foliot, Stanford Online Accessibility Program.

User-Interface (continued)

nav-index Specifies the tabbing order for an element

nav-down Specifies the position of the element when using the arrow-down navigation key

nav-left Specifies the position of the element when using the arrow-left navigation key

nav-right Specifies the position of the element when using the arrow-right navigation key

nav-up Specifies the position of the element when using the arrow-up navigation key Example: Currently no browser supports the nav* properties

Page 29: Implementing the new features Mark Branom, IT Services John Foliot, Stanford Online Accessibility Program.

Content for Paged Media (print)

bookmark-label Specifies the label of the bookmark

bookmark-level Specifies the level of the bookmark

bookmark-target Specifies the target of the bookmark link Example:

http://www.w3.org/TR/css3-gcpm/#bookmarks

float-offset Pushes floated elements in the opposite direction of the where they have been floated with float Example:

http://www.w3.org/TR/css3-gcpm/#the-float-offset-property image-resolution

Specifies the resolution of an image Example:

http://dev.w3.org/csswg/css3-images/#image-resolution marks

Adds crop and/or cross marks to the document Example:

http://www.quackit.com/css/properties/css_marks.cfm string-set

Named strings are created with the ‘string-set’ property which copies a string of text into the named string. Only text is copied; not style, structure, or replaced content Example:

http://www.w3.org/TR/css3-gcpm/#string-set

Page 30: Implementing the new features Mark Branom, IT Services John Foliot, Stanford Online Accessibility Program.

Content for Paged Media (print) - continued hyphenate-after

Specifies the minimum number of characters in a hyphenated word after the hyphenation character

hyphenate-before Specifies the minimum number of characters in a hyphenated word before the hyphenation character

hyphenate-character Specifies a string that is shown when a hyphenate-break occurs

hyphenate-lines Indicates the maximum number of successive hyphenated lines in an element

hyphenate-resource Specifies a comma-separated list of external resources that can help the browser determine hyphenation points

hyphens Sets how to split words to improve the layout of paragraphs

Example:http://meyerweb.com/eric/css/tests/css3/show.php?p=hyphens

Page 31: Implementing the new features Mark Branom, IT Services John Foliot, Stanford Online Accessibility Program.

More Paged Media Properties

object-fit Gives a hint for how to scale a replaced element if neither its width nor its height property is auto

object-position Determines the alignment of the object inside the box Examples:

http://www.w3.org/TR/css3-images/#object-fithttp://www.w3.org/TR/css3-images/#object-position

image-orientation

Specifies a rotation in the right or clockwise direction that a user agent applies to an image Example:

http://dev.w3.org/csswg/css3-images/#image-orientation

size Specifies the size and orientation of the containing box for page content Example:

http://dev.w3.org/csswg/css3-page/#page-size-prop

Page 32: Implementing the new features Mark Branom, IT Services John Foliot, Stanford Online Accessibility Program.

Speech

mark A shorthand property for setting the mark-before and mark-after properties

mark-after Allows named markers to be attached to the audio stream

mark-before Allows named markers to be attached to the audio stream

phonemes Specifies a phonetic pronunciation for the text contained by the corresponding element

rest A shorthand property for setting the rest-before and rest-after properties

rest-after Specifies a rest or prosodic boundary to be observed after speaking an element's content

rest-before Specifies a rest or prosodic boundary to be observed before speaking an element's content

Page 33: Implementing the new features Mark Branom, IT Services John Foliot, Stanford Online Accessibility Program.

Speech (continued)

voice-balance Specifies the balance between left and right channels

voice-duration Specifies how long it should take to render the selected element's content

voice-pitch Specifies the average pitch (a frequency) of the speaking voice

voice-pitch-range Specifies variation in average pitch

voice-rate Controls the speaking rate

voice-stress Indicates the strength of emphasis to be applied

voice-volume Refers to the amplitude of the waveform output by the speech synthesizes

Examples:http://www.css3.info/preview/speech/http://dev.w3.org/csswg/css3-speech/

Page 34: Implementing the new features Mark Branom, IT Services John Foliot, Stanford Online Accessibility Program.

Linebox

alignment-adjust Allows more precise alignment of elements

alignment-baseline Specifies how an inline-level element is aligned with respect to its parent

baseline-shift Allows repositioning of the dominant-baseline relative to the dominant-baseline

dominant-baseline Specifies a scaled-baseline-table

drop-initial-after-adjust Sets the alignment point of the drop initial for the primary connection point

drop-initial-after-align Sets which alignment line within the initial line box is used at the primary connection point with the initial letter box

drop-initial-before-adjust Sets the alignment point of the drop initial for the secondary connection point

drop-initial-before-align Sets which alignment line within the initial line box is used at the secondary connection point with the initial letter box

drop-initial-size Controls the partial sinking of the initial letter

drop-initial-value Activates a drop-initial effect

Page 35: Implementing the new features Mark Branom, IT Services John Foliot, Stanford Online Accessibility Program.

Linebox (continued)

inline-box-align Sets which line of a multi-line inline block align with the previous and next inline elements within a line

line-stacking A shorthand property for setting the line-stacking-strategy, line-stacking-ruby, and line-stacking-shift properties

line-stacking-ruby Sets the line stacking method for block elements containing ruby annotation elements

line-stacking-shift Sets the line stacking method for block elements containing elements with base-shift

line-stacking-strategy Sets the line stacking strategy for stacked line boxes within a containing block element

text-heightSets the block-progression dimension of the text content area of an inline box

Example:http://dev.w3.org/csswg/css3-linebox/#properties

Page 36: Implementing the new features Mark Branom, IT Services John Foliot, Stanford Online Accessibility Program.

Hyperlink

target A shorthand property for setting the target-name, target-new, and target-position properties

target-name Specifies where to open links (target destination)

target-new Specifies whether new destination links should open in a new window or in a new tab of an existing window

target-position Specifies where new destination links should be placed

Examples:http://thinkvitamin.com/design/stay-on-target/http://virtuelvis.com/gallery/css3/target/interface.htmlhttp://www.uselesscode.org/blog/82/pure-css3-tab-widget

Page 37: Implementing the new features Mark Branom, IT Services John Foliot, Stanford Online Accessibility Program.

Some CSS3 Resources…

http://www.stanford.edu/group/ttsclasses/css/

http://border-radius.com/

http://caniuse.com/

http://css-tricks.com/

http://css3.bradshawenterprises.com

http://css3.info/

http://cssplay.co.uk/menu/css3-marquee.html

http://davidwalsh.name/dw-content/webkit-styles.php

http://dev.w3.org/csswg/

http://fontsquirrel.com/

http://google.com/webfonts

http://hex2rgba.devoth.com/

http://hslpicker.com/

http://html5rocks.com/

http://leemunroe.com

http://meyerweb.com/eric/css/

http://msdn.microsoft.com/

http://quackit.com/css

http://quirksmode.org/css/contents.html

http://standardista.com

http://standardista.com/sxsw

http://storiesinflight.com/html5/ruby.html

http://stubbornella.org/content/category/general/geek/css/

http://thinkvitamin.com/design/stay-on-target/

http://uselesscode.org/blog/82/pure-css3-tab-widget

http://virtuelvis.com/gallery/css3/target/interface.html

http://w3.org/

http://w3schools.com

http://westciv.com/tools/3Dtransforms

http://xanthir.com/blog

http://xanthir.com/blog/b4580

http://selectivizr.com