**css3 学习小结**
1.CSS3 边框
border-radius
border-radius:5px;-webkit-border-radius:5px;
box-shadow
box-shadow:3px 3px 3px #ccc;
border-image
其中有两个参数 一个是round案例如下:
border-image:url(../images/1.png) 30 30 round;
-moz-border-image:url(../images/1.png) 30 30 round;
-webkit-border-image:url(../images/1.png) 30 30 round;
-o-border-image:url(../images/1.png) 30 30 round;
其中有两个参数 另一个是stretch案例如下(格式如上):
border-image:url(../image/1.png) 30 30 stretch;
2.CSS3 背景
background-size
background-size:100% 100%;
background-size:45px 45px;
background:url(../image/1.png) no-repeat;
background-origin(规定背景图片的定位区域)
有三个值:content-box;padding-box;border-box;
background-origin:翻译出 来就是背景图片的起源:从内容部分起源;从内边距起源;从边框起源
background-image:url(bg_flower.gif),url(bg_flower_2.gif);
3.CSS3 文本效果
text-shadow: 5px 5px 5px #FF0000;
word-wrap:break-word
text-align:justify;
text-justify:inter-word;
text-overflow:ellipsis;
word-break: break-all;
word-wrap:break-word;
4.CSS3 字体
<style>
@font-face{
font-family: myFirstFont;
src: url('Sansation_Light.ttf'),
url('Sansation_Light.eot');
}
div{font-family:myFirstFont;}
</style>
5.CSS3 2D 转换
translate()
transform:translate(50px,100px);
-ms-transform:translate(360deg);
-webkit-transform:translate(360deg);
-o-transform: translate(30deg);
-moz-transform: translate(30deg);
rotate()
transform: rotate(30deg);
-ms-transform:rotate(360deg);
-webkit-transform:rotate(360deg);
-o-transform: rotate(30deg);
-moz-transform: rotate(30deg);
scale()
transform:scale(2,4);
-ms-transform:scale(2,4);
-webkit-transform:scale(2,4);
-o-transform:scale(2,4);
-moz-transform:scale(2,4);
skew()
transform: skew(30deg,20deg);
-ms-transform: skew(30deg,20deg);
-webkit-transform: skew(30deg,20deg);
-o-transform: skew(30deg,20deg);
-moz-transform: skew(30deg,20deg);
matrix()
transform:matrix(0.866,0.5,-0.5,0.866,0,0);
-ms-transform:matrix(0.866,0.5,-0.5,0.866,0,0);
-moz-transform:matrix(0.866,0.5,-0.5,0.866,0,0);
-webkit-transform:matrix(0.866,0.5,-0.5,0.866,0,0);
-o-transform:matrix(0.866,0.5,-0.5,0.866,0,0);
5.CSS3 3D 转换
rotateX()
transform: rotateX(120deg);
-webkit-transform: rotateX(120deg);
-moz-transform: rotateX(120deg);
rotateY()
transform: rotateY(130deg);
-webkit-transform: rotateY(130deg);
-moz-transform: rotateY(130deg);
6.CSS3 过渡
transition: width 2s, height 2s, transform 2s;
-moz-transition: width 2s, height 2s, -moz-transform 2s;
-webkit-transition: width 2s, height 2s, -webkit-transform 2s;
-o-transition: width 2s, height 2s,-o-transform 2s;
div
{
transition-property: width;
transition-duration: 1s;
transition-timing-function: linear;
transition-delay: 2s;
简写成:transition: width 1s linear 2s;
-moz-transition-property:width;
-moz-transition-duration:1s;
-moz-transition-timing-function:linear;
-moz-transition-delay:2s;
-webkit-transition-property:width;
-webkit-transition-duration:1s;
-webkit-transition-timing-function:linear;
-webkit-transition-delay:2s;
-o-transition-property:width;
-o-transition-duration:1s;
-o-transition-timing-function:linear;
-o-transition-delay:2s;
}
7.CSS3 动画
@keyframes myfirst{
form{background:red;}
to{background:yellow;}
}
@keyframes mysec{
0% {background:red;}
25% {background:yellow;}
50% {background:pink;}
100% {background:black;}
}
.main{animation:myfirst 1s;}
{animation: myfirst 5s linear 2s infinite alternate;}
7.CSS3 多列
column-count
-moz-column-count:3;
-webkit-column-count:3;
column-count:3;
column-gap
-moz-column-gap:40px;
-webkit-column-gap:40px;
column-gap:40px;
column-rule
-moz-column-rule:3px outset #ff0000;
-webkit-column-rule:3px outset #ff0000;
column-rule:3px outset #ff0000;
8.CSS3 用户界面
resize
resize:both;
overflow:auto;
box-sizing
border:1px solid #ccc
width:50%;
float:left;
box-sizing:border-box;
-moz-box-sizing:border-box;
-webkit-box-sizing:border-box;
outline-offset
border: 2px solid black;
outline: 2px solid red;
outline-offset: 15px;