{ PH_Dev }

Published on

連續記錄挑戰Day30-CSS3有什麼新特性?

Authors
  • avatar
    Name
    Penghua Chen(PH)
    Twitter

在爬面試題目找關於css3的新增的部分時,找到了 TutorialRepublic這個網站,對於css3的新特性整理的很詳細、易懂,於是我就摘錄了關於新增特性的部分並另外彙整支援度(CanIUse)w3.org的定義以及w3school的範例Demo。

CSS3 有哪些新特性?

僅列舉新增的特性。

Animation

PropertyDescription
animationSpecifies the keyframe-based animations.
animation-delaySpecifies when the animation will start.
animation-directionSpecifies whether the animation should play in reverse on alternate cycles or not.
animation-durationSpecifies the number of seconds or milliseconds an animation should take to complete one cycle.
animation-fill-modeSpecifies how a CSS animation should apply styles to its target before and after it is executing.
animation-iteration-countSpecifies the number of times an animation cycle should be played before stopping.
animation-name (@keyframes)Specifies the name of @keyframes defined animations that should be applied to the selected element.
animation-play-stateSpecifies whether the animation is running or paused.
animation-timing-functionSpecifies how a CSS animation should progress over the duration of each cycle.

支援度:caniuse

TutorialRepublic

w3schools

Background

PropertyDescription
background-clipSpecifies the painting area of the background.
background-originSpecifies the positioning area of the background images.
background-sizeSpecifies the size of the background images.

支援度:caniuse

TutorialRepublic

w3schools

Border

PropertyDescription
border-bottom-left-radiusDefines the shape of the bottom-left border corner of an element.
border-bottom-right-radiusDefines the shape of the bottom-right border corner of an element.
border-top-left-radiusDefines the shape of the top-left border corner of an element.
border-top-right-radiusDefines the shape of the top-right border corner of an element.
border-imageSpecifies how an image is to be used in place of the border styles.
border-image-outsetSpecifies the amount by which the border image area extends beyond the border box.
border-image-repeatSpecifies whether the image-border should be repeated, rounded or stretched.
border-image-sliceSpecifies the inward offsets of the image-border.
border-image-sourceSpecifies the location of the image to be used as a border.
border-image-widthSpecifies the width of the image-border.
border-radiusDefines the shape of the border corners of an element.

支援度:caniuse

TutorialRepublic

w3schools

Color

PropertyDescription
opacitySpecifies the transparency of an element.

支援度:caniuse

TutorialRepublic

w3schools

Flexible Box

PropertyDescription
flexSpecifies the components of a flexible length.
flex-basisSpecifies the initial main size of the flex item.
flex-directionSpecifies the direction of the flexible items.
flex-flowA shorthand property for the flex-direction and the flex-wrap properties.
flex-growSpecifies how the flex item will grow relative to the other items inside the flex container.
flex-shrinkSpecifies how the flex item will shrink relative to the other items inside the flex container.
flex-wrapSpecifies the transparency of an element.
align-contentSpecifies the alignment of flexible container's items within the flex container.
align-itemsSpecifies the default alignment for items within the flex container.
align-selfSpecifies the alignment for selected items within the flex container.
justify-contentSpecifies how flex items are aligned along the main axis of the flex container after any flexible lengths and auto margins have been resolved.
orderSpecifies the order in which a flex items are displayed and laid out within a flex container.

支援度:caniuse

TutorialRepublic

w3schools

Font Properties

PropertyDescription
font-size-adjustPreserves the readability of text when font fallback occurs.
font-stretchSelects a normal, condensed, or expanded face from a font.

支援度:

font-size-adjust

font-stretch

TutorialRepublic

w3schools

Multi-column Layout Properties

PropertyDescription
columnsA shorthand property for setting column-width and column-count properties.
column-countSpecifies the number of columns in a multi-column element.
column-fillSpecifies how columns will be filled.
column-gapSpecifies the gap between the columns in a multi-column element.
column-ruleSpecifies a straight line, or "rule", to be drawn between each column in a multi-column element.
column-rule-colorSpecifies the color of the rules drawn between columns in a multi-column layout.
column-rule-styleSpecifies the style of the rule drawn between the columns in a multi-column layout.
column-rule-widthSpecifies the width of the rule drawn between the columns in a multi-column layout.
column-spanSpecifies how many columns an element spans across in a multi-column layout.
column-widthSpecifies the optimal width of the columns in a multi-column element.

支援度:

caniuse

TutorialRepublic

w3schools

Outline Properties

PropertyDescription
outline-offsetSet the space between an outline and the border edge of an element.

支援度:caniuse

TutorialRepublic

w3schools

Text Properties

PropertyDescription
tab-sizeSpecifies the length of the tab character.
text-align-lastSpecifies how the last line of a block or a line right before a forced line break is aligned when text-align is justify.
text-decoration-colorSpecifies the color of the text-decoration-line.
text-decoration-lineSpecifies what kind of line decorations are added to the element.
text-decoration-styleSpecifies the style of the lines specified by the text-decoration-line property
text-justifySpecifies the justification method to use when the text-align property is set to justify.
text-overflowSpecifies how the text content will be displayed, when it overflows the block containers.
text-shadowApplies one or more shadows to the text content of an element.
word-breakSpecifies how to break lines within words.
word-wrapSpecifies whether to break words when the content overflows the boundaries of its container.

支援度: tab-size text-align-last text-decoration-color text-decoration-line text-decoration-style text-justify text-overflow text-shadow word-break word-wrap

TutorialRepublic

w3schools

Transform

PropertyDescription
transformApplies a 2D or 3D transformation to an element.
transform-originDefines the origin of transformation for an element.
transform-styleSpecifies how nested elements are rendered in 3D space.
perspective-originDefines the origin (the vanishing point for the 3D space) for the perspective property.
perspectiveDefines the perspective from which all child elements of the object are viewed.
backface-visibilitySpecifies whether or not the "back" side of a transformed element is visible when facing the user.

支援度:caniuse

TutorialRepublic

w3schools

Transitions

PropertyDescription
transitionDefines the transition between two states of an element.
transition-delaySpecifies when the transition effect will start.
transition-durationSpecifies the number of seconds or milliseconds a transition effect should take to complete.
transition-propertySpecifies the names of the CSS properties to which a transition effect should be applied.
transition-timing-functionSpecifies the speed curve of the transition effect.

支援度:caniuse

TutorialRepublic

w3schools

Visual formatting Properties

PropertyDescription
overflow-xSpecifies how to manage the content when it overflows the width of the element's content area.
overflow-ySpecifies how to manage the content when it overflows the height of the element's content area.
resizeSpecifies whether or not an element is resizable by the user.
box-shadowApplies one or more drop-shadows to the element's box.
box-sizingAlter the default CSS box model.

支援度: overflow-x overflow-y resize box-shadow box-sizing

TutorialRepublic

w3schools

CSS3 有哪些新的 selectors?

PatternRepresents
E[foo^="bar"]an E element whose "foo" attribute value begins exactly with the string "bar"
E[foo$="bar"]an E element whose "foo" attribute value ends exactly with the string "bar"
E[foo*="bar"]an E element whose "foo" attribute value contains the substring "bar"
E:rootan E element, root of the document
E:nth-child(n)an E element, the n-th child of its parent
E:nth-last-child(n)an E element, the n-th child of its parent, counting from the last one
E:nth-of-type(n)an E element, the n-th sibling of its type
E:nth-last-of-type(n)an E element, the n-th sibling of its type, counting from the last one
E:last-childan E element, last child of its parent
E:first-of-typean E element, first sibling of its type
E:last-of-typean E element, last sibling of its type
E:only-childan E element, only child of its parent
E:only-of-typean E element, only sibling of its type
E:emptyan E element that has no children (including text nodes)
E:targetan E element being the target of the referring URI
E:enableda user interface element E which is enabled or disabled
E:disableda user interface element E which is enabled or disabled
E:checkeda user interface element E which is checked (for instance a radio-button or checkbox)
E:not(s)an E element that does not match simple selector s
E ~ Fan F element preceded by an E element

引用來源:

TutorialRepublic w3schools w3.org - Selectors