不一樣的背景圖像可用逗號隔開css
<style> #example1 { background-image: url(img_flwr.gif), url(paper.gif); background-position: right bottom, left top; background-repeat: no-repeat, repeat; padding: 15px; } </style>
background-origin: content-box/padding-box/ border-box
background-origin屬性指定了背景圖像的位置區域css3
background-clip: content-box/padding-box/ border-box
background-clip屬性規定背景的繪製區域web
<style> #grad1 { height: 200px; background: -webkit-linear-gradient(red, green); /* Safari 5.1 - 6.0 */ background: -o-linear-gradient(red, green); /* Opera 11.1 - 12.0 */ background: -moz-linear-gradient(red, green); /* Firefox 3.6 - 15 */ background: linear-gradient(red, green); /* 標準的語法(必須放在最後 /* background: linear-gradient(to right, red, green); 漸變方向向右 */ /* background: linear-gradient(to bottom right, red, green); 漸變方向向右下角 */ /* background: linear-gradient(35deg, red, green); 漸變方向 漸變線35deg */ /* background: linear-gradient(to right, red, green, blue, orange); 使用多個顏色節點 */ /* background: linear-gradient(to right, rgba(255,0,0,0), rgba(255,0,0,1)); 漸變顏色可設置透明度*/ /* background: repeating-linear-gradient(red, yellow 10%, green 20%); 可重複線性漸變 */ /* background: radial-gradient(red, green, blue); 徑向漸變 */ /* background: radial-gradient(circle, red, yellow, green); 設置形狀的徑向漸變 */ } </style>
Internet Explorer 9 及以前的版本不支持漸變。css3動畫
<h5 style="text-shadow: 5px 5px 5px #FF0000;">文字效果 text sfdfsfsdfsfsf</h5>
text-overflow: ellipsis; 超出的文本 省略顯示 ...佈局
word-wrap:break-word; 容許長文本換行字體
word-break: keep-all/break-all 單詞是否拆分換行flex
可選擇本身須要的字體動畫
<style> @font-face { font-family: myfontname; src: url(font.woff); } div { font-family:myfontname; } </style>
對元素進行移動、縮放、轉動、拉長或拉伸。url
div { transform: rotate(30deg); -ms-transform: rotate(30deg); /* IE 9 */ -webkit-transform: rotate(30deg); /* Safari and Chrome */ }
transform屬性spa
元素從一種樣式逐漸改變爲另外一種的效果。
div { width:100px; height:100px; background:red; transition: width 2s, height 2s, transform 2s; -webkit-transition: width 2s, height 2s, -webkit-transform 2s;/* Safari or Chrome on MacOS*/ } div:hover { width:300px; }
transition屬性
@keyframes 建立動畫
@keyframes myfirst { from {background: red;} to {background: yellow;} } @-webkit-keyframes myfirst /* Safari 與 Chrome */ { from {background: red;} to {background: yellow;} } @keyframes myframes { 0% {background: red;} 25% {background: yellow;} 50% {background: blue;} 100% {background: green;} } @-webkit-keyframes myframes /* Safari 與 Chrome */ { 0% {background: red;} 25% {background: yellow;} 50% {background: blue;} 100% {background: green;} } div { animation: myfirst 5s; -webkit-animation: myfirst 5s; /* Safari 與 Chrome */ }
animation屬性
div { -webkit-column-rule: 1px solid lightblue; /* Chrome, Safari, Opera */ -moz-column-rule: 1px solid lightblue; /* Firefox */ column-rule: 1px solid lightblue; } h2 {column-span: all;}
.flex-container { display: -webkit-flex; display: flex; width: 400px; height: 250px; background-color: lightgrey; } .flex-item { background-color: cornflowerblue; width: 100px; height: 100px; margin: 10px; }
align-content: flex-start | flex-end | center | space-between | space-around | stretch
align-self: auto | flex-start | flex-end | center | baseline | stretch 子元素自身的對齊方式