CSS3
入门课程
1
2
3
4
@font-face{ font-family: myFirstFont; src: url('Sansation_Light.ttf'), url('Sansation_Light.eot'); /* IE9 */ }
@font-face { font-family: 'miaov'; src:url(../fonts/glyphicons.eot); src:url(../fonts/glyphicons.eot?#iefix) format('embedded-opentype'), url(../fonts/glyphicons.woff2) format('woff2'), url(../fonts/glyphicons.woff) format('woff'), url(../fonts/glyphicons.ttf) format('truetype'), url(../fonts/glyphicons.svg#glyphicons_halflingsregular) format('svg') }
盒模型设计
响应式布局
5
.foo{ display: -webkit-box; /* Chrome 4+, Safari 3.1, iOS Safari 3.2+ */ display: -moz-box; /* Firefox 17- */ display: -webkit-flex; /* Chrome 21+, Safari 6.1+, iOS Safari 7+, Opera 15/16 */ display: -moz-flex; /* Firefox 18+ */ display: -ms-flexbox; /* IE 10 */ display: flex; /* Chrome 29+, Firefox 22+, IE 11+, Opera 12.1/17/18, Android 4.4+ */ }
6
7
@media not|only mediatype and (expressions) { CSS 代码...; }
@media screen{ 选择器{ 属性:属性值; } }
@import url("css/reset.css") screen;
@media screen and (min-width:400px) and (max-width:500px) { .box {margin: 0 auto;} }
8
background: -webkit-linear-gradient(red, blue); /* Safari 5.1 - 6.0 */ background: -o-linear-gradient(red, blue); /* Opera 11.1 - 12.0 */ background: -moz-linear-gradient(red, blue); /* Firefox 3.6 - 15 */ background: linear-gradient(red, blue); /* 标准的语法 */
/* Safari 5.1 - 6.0 */ background: -webkit-repeating-linear-gradient(red, yellow 10%, green 20%); /* Opera 11.1 - 12.0 */ background: -o-repeating-linear-gradient(red, yellow 10%, green 20%); /* Firefox 3.6 - 15 */ background: -moz-repeating-linear-gradient(red, yellow 10%, green 20%); /* 标准的语法 */ background: repeating-linear-gradient(red, yellow 10%, green 20%);
CSS3过渡
2D转换
3D转换
CSS3动画
9
10
11
12
@keyframes 动画名称 { 动画状态 }
@keyframes miaov_test { from { background:red; } to { background:green; } }可以只有to 1
-webkit-animation-name: 'miaov'; -webkit-animation-duration: 4s;