好得很程序员自学网

<tfoot draggable='sEl'></tfoot>

CSS3了解过的样式记录_html/css_WEB-ITnose

一、CSS3边框

1、圆角border-radius

border-radius:值越大,角越圆;

div{    width:100px;    height:100px;    background-color:red;    border-radius:10px;    border-top-left-radius:20px;} 
border-top-left-radius:2em; border-top-right-radius:2em; border-bottom-right-radius:2em; border-bottom-left-radius:2em;

也可以根据上面4个参数,单独设置某个角。

2、阴影box-shadow
div{  width:100px;  height:100px;  background-color:yellow;  box-shadow: 10px 10px 5px #d8d8d8;} 

box-shadow: h-shadow v-shadow blur spread color inset;

h-shadow:水平向右偏移量;

v-shadow:垂直向下偏移量;

blur:模糊距离;

spread:阴影尺寸;

color:阴影颜色;

inset:改为内阴影;

3、边框图片 border-image border-image-source 用在边框的图片的路径。 border-image-slice 图片边框向内偏移。 border-image-width 图片边框的宽度。 border-image-outset 边框图像区域超出边框的量。 border-image-repeat 图像边框是否应平铺(repeated)、铺满(rounded)或拉伸(stretched)。

二、CSS3 背景

1、background-size:控制背景图片的大小;

background-size:20px 20px; 

2、background-origin:3个属性可选;

padding-box 背景图像相对于内边距框来定位。 border-box 背景图像相对于边框盒来定位。 content-box 背景图像相对于内容框来定位。

3、background-clip:规定背景的绘制区域。

padding-box 背景图像相对于内边距框来定位。 border-box 背景图像相对于边框盒来定位。 content-box 背景图像相对于内容框来定位。

另外在CSS3中,background-image:可以设置多张图片了。

background-image:url(1.gif),url(2.gif); 

三、过渡transition

transition:简写属性,用于在一个属性中设置四个过渡属性。 transition-property:规定应用过渡的 CSS 属性的名称。 transition-duration:定义过渡效果花费的时间。默认是 0。 transition-timing-function:规定过渡效果的时间曲线。默认是 "ease"。 transition-delay:规定过渡效果何时开始。默认是 0。

其中transition-timing-function过渡时间,有以下几种,你可以规定它过渡的速度。

linear 规定以相同速度开始至结束的过渡效果(等于 cubic-bezier(0,0,1,1))。 ease 规定慢速开始,然后变快,然后慢速结束的过渡效果(cubic-bezier(0.25,0.1,0.25,1))。 ease-in 规定以慢速开始的过渡效果(等于 cubic-bezier(0.42,0,1,1))。 ease-out 规定以慢速结束的过渡效果(等于 cubic-bezier(0,0,0.58,1))。 ease-in-out 规定以慢速开始和结束的过渡效果(等于 cubic-bezier(0.42,0,0.58,1))。 cubic-bezier(n,n,n,n) 在 cubic-bezier 函数中定义自己的值。可能的值是 0 至 1 之间的数值。
     div{    width:200px;    height:200px;    background-color:#d8d8d8;}div:hover{    width:300px;    transition: width 2s;}       

查看更多关于CSS3了解过的样式记录_html/css_WEB-ITnose的详细内容...

  阅读:35次