CSS属性定义.doc_第1页
CSS属性定义.doc_第2页
CSS属性定义.doc_第3页
CSS属性定义.doc_第4页
CSS属性定义.doc_第5页
已阅读5页,还剩18页未读 继续免费阅读

下载本文档

版权说明:本文档由用户提供并上传,收益归属内容提供方,若内容存在侵权,请进行举报或认领

文档简介

CSS样式属性1、字体属性(type)font-family(使用什么字体)font-style(字体的样式,是否斜体):normal/italic/obliquefont-variant(字体大小写):normal/small-capsfont-weight(字体的粗细):normal/bold/bolder/lithterfont-size(字体的大小):absolute-size/relative-size/length/percentage2、颜色和背景属性(backgroud)color(定义前景色,例如:pcolor:red)background-color(定义背景色)background-image(定义背景图片)background-repeat(背景图案重复方式):repeat-x/repeat-y/no-repeatbackground-attachment(设置滚动):scroll(滚动)/fixe(固定的)background-position(背景图案的初始位置):percentage/length/top/left/right/bottom3、文本属性:(block)定义间距:word-spacing(单词之间的距离)letter-spacing(字母之间的距离)text-decoration(定义文字的装饰):nore/underline/overline/line-through/blinkvertical-align(元素在垂直方向的位置):baseline(基线)/sub/super/top/text-top/middle/bottom/text-bottomtext-transform(使文本转换为其它方式):capitalize(大写)/uppercase(首字母大写)/lowercase(小写)/nonetext-align(文字的对齐):left/right/center/justifytext-indent(文本的首行缩进)length/percentageline-height(文本的行高):normal/numbet/lenggth/percentage(百分比)定义超链接:a:link color:green;text-decoration:nore(未访问过的状态)a:visited color:ren;text-decoration:underline;16pt(访问过的状态)a:hover color:blue;text-decoration:underline;16pt(鼠标激活的状态)4、块属性(block)边距属性:margin-top(设置顶边距)margin-right(设置右边距)margin-bottom(设置底边距)margin-left(设置左边距)填充距属性:padding-top设置顶端真充距)padding-right设置顶端真充距)padding-bottom设置顶端真充距)padding-left设置顶端真充距)5、边框属性(border)border-top-width(顶端边框宽度)border-right-width(右端边框宽度)border-bottom-width(底端边框宽度)border-left-width(d左边框宽度)border-width(一次定义边框宽度)border-color(设置边框颜色)border-style(设置边框样式)border-top(一次定义顶端各种属性)border-right(一次定义右端各种属性)border-bottom(一次定义底端各种属性)border-left(一次定义左端各种属性)图文混排:width(定义宽度属性)height(定义高度属性)float(文字环绕在一个元素的四周)clear(定义某一边是否有环绕)6、项目符号和编号(list)display(定义是否显示)white-space(怎样处理空白部分):normal/pre/nowraplist-style-type(在列表前加项目符号)disc(圆点)/circle(圈)/square(方形)/decimal(阿拉伯数字)/lower-roman(小写罗马数字)/upper-roman(大写罗马数字)/lower-alpha(小写英文字母)/upper-alpha(大写英文字母)/norelist-style-tyle(在列表前加图案):/nonelist-style-position(决定列表项中第二行的起邕位置)list-style(一次性定义所有属性)7、定位(positioning) 即层属性Type:设定对象的定位方式。有三种方式:Absolute(绝对定位)、Relative(相对定位)、Static(无特殊定位)。相对应的CSS属性是”position”。Visibility:设定对象定位层的最初显示状态。有三种状态:Inherit(继承父层的显示属性)、Visible(对象可视)、Hidden隐藏对象。相对应的CSS属性是”visibility”。Z-Index:设置对象的层叠顺序。编号较大的层会显示在编号较小的层上边。变量值可以是正值也可以是负值。相对应的CSS属性是”z-index”。Overflow:设置如果层的内容超出了层的大小时如何处理。有四种处理方式:visible,增加层的大小,从而将层的所有内容显示出来;hidden,保持层的大小不变,将超出层的内容剪裁掉;Scroll,总是显示滚动;Auto,只有在内容超出层的边界时才显示滚动条。相对应的CSS属性是”overflow”。 Placement:设置对象定位层的位置和大小。可以分别设置left(左边定位)、top(顶部定位)、width(宽)、height(高)。相对应的CSS属性分别是”left; top; width; height”。Clip:定义定位层的可视区域。区域外的部分为不可视区,为透明的。可以理解为在定位层上放一个矩形遮罩的效果。相对应的CSS属性是”clip”。8、扩展(Extensions)Pagebreak:在打印的时候强迫在样式控制的对象前后换页。Before:设置对象前出现的页分割符。设置为always时,始终在对象之前插入页分割符。相对应的CSS属性是”page-break-before”。After:设置对象后出现的页分割符。设置为always时,始终在对象之后插入页分割符。相对应的CSS属性是”。注意:以上IE5仅支持always值和空白值(null)。Cursor:当鼠标滑过样式控制的对象时改变鼠标形状。可以设置为hand(手型)、crosshair(“十”型)、text (“I”型)、wait(等待)、default(默认)、help(帮助)、e-resize(东箭头)、ne-resize(东北箭头)、n-resize(北箭头)、nw-resize(西北箭头)、w-resize(西箭头)、sw-resize(西南箭头)、s-resize(南箭头)、se-resize(东南箭头)和auto(自动)。CSS滤镜属性Filter:在样式中加上滤镜特效。由于此属性内容比较多,我们将到下一章单独对滤镜介绍。1.Alpha:设置透明度Alpha(Opacity=?, FinishOpacity=?, Style=?, StartX=?, StartY=?, FinishX=?, FinishY=?)Opacity:透明度级别,范围是0-100,0代表完全透明,100代表完全不透明。FinishOpacity:设置渐变的透明效果时,用来指定结束时的透明度,范围也是0 到 100。Style:设置渐变透明的样式,值为0代表统一形状、1代表线形、2代表放射状、3代表长方形。StartX和StartY:代表渐变透明效果的开始X和Y坐标。 FinishX和FinishY:代表渐变透明效果结束X和Y 的坐标。2.BlendTrans:图像之间的淡入和淡出的效果BlendTrans(Duration=?) Duration:淡入或淡出的时间。注意:这个滤镜必须配合JS建立图片序列,才能做出图片间效果。3.Blru:建立模糊效果Blur(Add=?, Direction=?, Strength=?) Add:是否单方向模糊,此参数是一个布尔值,true(非0)或false(0)。 Direction:设置模糊的方向,其中0度代表垂直向上,然后每45度为一个单位。 Strength:代表模糊的象素值。4.Chroma:把指定的颜色设置为透明Chroma(Color=?) Color:是指要设置为透明的颜色。5.DropShadow:建立阴影效果DropShadow(Color=?, OffX=?, OffY=?, Positive=?) Color:指定阴影的颜色。OffX:指定阴影相对于元素在水平方向偏移量,整数。 OffY:指定阴影相对于元素在垂直方向偏移量,整数。 Positive:是一个布尔值,值为true(非0)时,表示为建立外阴影;为false(0),表示为建立内阴影。6.FlipH:将元素水平反转7.FlipV:将元素垂直反转8.Glow:建立外发光效效果Glow(Color=?, Strength=?)Color:是指定发光的颜色。Strength:光的强度,可以是1到255之间的任何整数,数字越大,发光的范围就越大。9.Gray:去掉图像的色彩,显示为黑白图象10.Invert:反转图象的颜色,产生类似底片的效果11.Light:放置光源的效果,可以用来模拟光源在物体上的投影效果 注意:此效果需要用JS设置光的位置和强度。12.Mask:建立透明遮罩Mask(Color=?) Color:设置底色,让对象遮住底色的部分透明。13.RevealTrans:建立切换效果RevealTrans(Duration=?, Transition=?)Duration:是切换时间,以秒为单位。Transtition:是切换方式,可设置为从0到23。注意:如果做页面间的切换效果,可以在区加上一行代码:。如果用在页面里的元素必须配合JS使用。14.Shadow:建立另一种阴影效果 Shadow(Color=?, Direction=?) Color:是指阴影的颜色。Direction:是设置投影的方向,0度代表垂直向上,然后每45度为一个单位。15.Wave:波纹效果Wave(Add=?, Freq=?, LightStrength=?, Phase=?, Strength=?) Add:表示是否显示原对象,0表示不显示,非0表示要显示原对象。 Freq:设置波动的个数。LightStrength:设置波浪效果的光照强度,从0到100。0表示最弱,100表示最强。 Phase:波浪的起始相角。从0到100的百分数值。(例如:25相当于90度,而50相当于180度。) Strength:设置波浪摇摆的幅度。16.Xray:显现图片的轮廓,X光片效果注意:在使用CSS滤镜时,必须使用在有区域的元素,比如表格,图片等。而文本,段落这样没有区域的元素不能使用CSS滤镜,对这样的元素我们可以设置元素的Height和Width样式或坐标来实现。纯CSS画的基本图形(矩形、圆形、三角形、多边形、爱心、八卦等),里面很多涉及到CSS3的一些属性。2012-08-27 09:11:23|分类:html5|举报|字号订阅今天在css-tricks上看到一篇文章,那篇文章让我不禁心头一震,强大的CSS啊,居然能画出这么多基本的图形。图形包括基本的矩形、圆形、 椭圆、三角形、多边形,也包括稍微复杂一点的爱心、钻石、阴阳八卦等。当然有一些需要用到CSS3的属性,所以在你打开这篇文章的时候,我希望你用的是 firefox或者chrome,当然IE也能看一部分的。那好,下面就一起来看看我们是如何用纯CSS来画这些图形的,如果你也觉得很震撼,推荐给你的 朋友吧。是不是我在博客园的权限不够,后台编辑器中不能加style标签,所以就用图片替代实际的效果图了,当然,想看实际效果的朋友可以移驾至我的另一 个博客,这篇文章两边是同步的,那边是实际的效果,原文:/ivy/archive/2012/1/16/css-shape.html1、正方形最终效果:CSS代码如下:#square width: 100px; height: 100px; background: red; 2、长方形最终效果:CSS代码如下:#rectangle width: 200px; height: 100px; background: red; 3、圆形最终效果:CSS代码如下:#circle width: 100px; height: 100px; background: red; -moz-border-radius: 50px; -webkit-border-radius: 50px; border-radius: 50px; 4、椭圆最终效果:CSS代码如下:#oval width: 200px; height: 100px; background: red; -moz-border-radius: 100px / 50px; -webkit-border-radius: 100px / 50px; border-radius: 100px / 50px; 5、上三角最终效果:CSS代码如下:#triangle-up width: 0; height: 0; border-left: 50px solid transparent; border-right: 50px solid transparent; border-bottom: 100px solid red; 6、下三角最终效果:CSS代码如下:#triangle-down width: 0; height: 0; border-left: 50px solid transparent; border-right: 50px solid transparent; border-top: 100px solid red; 7、左三角最终效果:CSS代码如下:#triangle-left width: 0; height: 0; border-top: 50px solid transparent; border-right: 100px solid red; border-bottom: 50px solid transparent; 8、右三角最终效果:CSS代码如下:#triangle-right width: 0; height: 0; border-top: 50px solid transparent; border-left: 100px solid red; border-bottom: 50px solid transparent; 9、左上三角最终效果:CSS代码如下:#triangle-topleft width: 0; height: 0; border-top: 100px solid red; border-right: 100px solid transparent; 10、右上三角最终效果:CSS代码如下:#triangle-topright width: 0; height: 0; border-top: 100px solid red; border-left: 100px solid transparent; 11、左下三角最终效果:CSS代码如下:#triangle-bottomleft width: 0; height: 0; border-bottom: 100px solid red; border-right: 100px solid transparent; 12、右下三角最终效果:CSS代码如下:#triangle-bottomright width: 0; height: 0; border-bottom: 100px solid red; border-left: 100px solid transparent; 13、平行四边形最终效果:CSS代码如下:#parallelogram width: 150px; height: 100px; margin-left:20px; -webkit-transform: skew(20deg); -moz-transform: skew(20deg); -o-transform: skew(20deg); background: red; 14、梯形最终效果:CSS代码如下:#trapezoid border-bottom: 100px solid red; border-left: 50px solid transparent; border-right: 50px solid transparent; height: 0; width: 100px; 15、六角星最终效果:CSS代码如下:#star-six width: 0; height: 0; border-left: 50px solid transparent; border-right: 50px solid transparent; border-bottom: 100px solid red; position: relative; #star-six:after width: 0; height: 0; border-left: 50px solid transparent; border-right: 50px solid transparent; border-top: 100px solid red; position: absolute; content: ; top: 30px; left: -50px; 16、五角星最终效果:CSS代码如下:#star-five margin: 50px 0; position: relative; display: block; color: red; width: 0px; height: 0px; border-right: 100px solid transparent; border-bottom: 70px solid red; border-left: 100px solid transparent; -moz-transform: rotate(35deg); -webkit-transform: rotate(35deg); -ms-transform: rotate(35deg); -o-transform: rotate(35deg); #star-five:before border-bottom: 80px solid red; border-left: 30px solid transparent; border-right: 30px solid transparent; position: absolute; height: 0; width: 0; top: -45px; left: -65px; display: block; content: ; -webkit-transform: rotate(-35deg); -moz-transform: rotate(-35deg); -ms-transform: rotate(-35deg); -o-transform: rotate(-35deg); #star-five:after position: absolute; display: block; color: red; top: 3px; left: -105px; width: 0px; height: 0px; border-right: 100px solid transparent; border-bottom: 70px solid red; border-left: 100px solid transparent; -webkit-transform: rotate(-70deg); -moz-transform: rotate(-70deg); -ms-transform: rotate(-70deg); -o-transform: rotate(-70deg); content: ; 17、五角大楼最终效果:CSS代码如下:#pentagon position: relative; width: 54px; border-width: 50px 18px 0; border-style: solid; border-color: red transparent; #pentagon:before content: ; position: absolute; height: 0; width: 0; top: -85px; left: -18px; border-width: 0 45px 35px; border-style: solid; border-color: transparent transparent red; 18、六边形最终效果:CSS代码如下:#hexagon width: 100px; height: 55px; background: red; position: relative; #hexagon:before content: ; position: absolute; top: -25px; left: 0; width: 0; height: 0; border-left: 50px solid transparent; border-right: 50px solid transparent; border-bottom: 25px solid red; #hexagon:after content: ; position: absolute; bottom: -25px; left: 0; width: 0; height: 0; border-left: 50px solid transparent; border-right: 50px solid transparent; border-top: 25px solid red; 19、八角形最终效果:CSS代码如下:#octagon width: 100px; height: 100px; background: red; position: relative; #octagon:before content: ; position: absolute; top: 0; left: 0; border-bottom: 29px solid red; border-left: 29px solid #eee; border-right: 29px solid #eee; width: 42px; height: 0; #octagon:after content: ; position: absolute; bottom: 0; left: 0; border-top: 29px solid red; border-left: 29px solid #eee; border-right: 29px solid #eee; width: 42px; height: 0; 20、爱心最终效果:CSS代码如下:#heart position: relative; width: 100px; height: 90px; #heart:before, #heart:after position: absolute; content: ; left: 50px; top: 0; width: 50px; height: 80px; background: red; -moz-border-radius: 50px 50px 0 0; border-radius: 50px 50px 0 0; -webkit-transform: rotate(-45deg); -moz-transform: rotate(-45deg); -ms-transform: rotate(-45deg); -o-transform: rotate(-45deg); transform: rotate(-45deg); -webkit-transform-origin: 0 100%; -moz-transform-origin: 0 100%; -ms-transform-origin: 0 100%; -o-transform-origin: 0 100%; transform-origin: 0 100%; #heart:after left: 0; -webkit-transform: rotate(45deg); -moz-transform: rotate(45deg); -ms-transform: rotate(45deg); -o-transform: rotate(45deg); transform: rotate(45deg); -webkit-transform-origin: 100% 100%; -moz-transform-origin: 100% 100%; -ms-transform-origin: 100% 100%; -o-transform-origin: 100% 100%; transform-origin :100% 100%; 21、无穷大符号最终效果:CSS代码如下:#infinity position: relative; width: 212px; height: 100px; #infinity:before, #infinity:after content: ; position: absolute; top: 0; left: 0; width: 60px; height: 60px; border: 20px solid red; -moz-border-radius: 50px 50px 0 50px; border-radius: 50px 50px 0 50px; -webkit-transform: rotate(-45deg); -moz-transform: rotate(-45deg); -ms-transform: rotate(-45deg); -o-transform: rotate(-45deg); transform: rotate(-45deg); #infinity:after left: auto; right: 0; -moz-border-radius: 50px 50px 50px 0; border-radius: 50px 50px 50px 0; -webkit-transform: rotate(45deg); -moz-transform: rotate(45deg); -ms-transform: rotate(45deg); -o-transform: rotate(45deg); transform: rotate(45deg); 22、鸡蛋最终效果CSS代码如下:#egg display:block; width: 126px; height: 180px; background-color: red; -webkit-border-radius: 63px 63px 63px 63px / 108px 108px 72px 72px; border-radius: 50% 50% 50% 50% / 60% 60% 40% 40%; 23、食逗人(Pac-Man)最终效果:CSS代码如下:#pacman width: 0px; height: 0px; border-right: 60px solid transparent; border-top: 60px solid red; border-left: 60px solid red; border-bottom: 60px solid red; border-top-left-radius: 60px; border-top-right-radius: 60px; border-bottom-left-radius: 60px; border-bottom-right-radius: 60px; 24、提示对话框最终效果:CSS代码如下:#talkbubble width: 120px; height: 80px; background: red; position: relative; -moz-border-radius: 10px; -webkit-border-radius: 10px; border-radius: 10px; #talkbubble:before content:; position: absolute; right: 100%; top: 26px; width: 0; height: 0; border-top: 13px solid transparent; border-right: 26px solid red; border-bottom: 13px solid transparent; 25、12角星最终效果:CSS代码如下:#burst-12 background: red; width: 80px; height: 80px; position: relative; text-align: center; #burst-12:before, #burst-12:after content: ; position: absolute; top: 0; left: 0; height: 80px; width: 80px; background: red; #burst-12:before -webkit-transform: rotate(30deg); -moz-transform: rotate(30deg); -ms-transform: rotate(30deg); -o-transform: rotate(30deg); transform: rotate(30deg); #burst-12:after -webkit-transform: rotate(60deg); -moz-transform: rotate(60deg); -ms-transform: rotate(60deg); -o-transform: rotate(60deg); transform: rotate(60deg); 26、8

温馨提示

  • 1. 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。图纸软件为CAD,CAXA,PROE,UG,SolidWorks等.压缩文件请下载最新的WinRAR软件解压。
  • 2. 本站的文档不包含任何第三方提供的附件图纸等,如果需要附件,请联系上传者。文件的所有权益归上传用户所有。
  • 3. 本站RAR压缩包中若带图纸,网页内容里面会有图纸预览,若没有图纸预览就没有图纸。
  • 4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
  • 5. 人人文库网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对用户上传分享的文档内容本身不做任何修改或编辑,并不能对任何下载内容负责。
  • 6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
  • 7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。

评论

0/150

提交评论