cssfilter:精通CSS滤镜(filter)来源: 发布时间:星期四, 2009年2月12日 浏览:167次 评论:0
由于学校 ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() CSS(Cascading Style Sheets) 层叠样式表单 ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() 可视化滤镜属性只能用在HTMLControl控件元素上 ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() 元素 介绍说明 BODY 网页文档 ![]() ![]() ![]() BUTTON 表单域 ![]() ![]() ![]() DIV 定义了网页上 ![]() ![]() ![]() ![]() ![]() IMG 图片元素 ![]() ![]() INPUT 输入表单域 MARQUEE 移动字幕效果 SPAN 定义了网页上 ![]() ![]() ![]() ![]() ![]() TABLE 表格 TD 表格数据单元格 TEXTAREA 文本区域 TFOOT 多行输入文本框 TH 表格标题单元格 THEAD 表格标题 TR 表格行 //////////////////////////////////////// IE4.0以上支持 ![]() 滤镜效果 描述 : Alpha 设置透明度 Blru 建立模糊效果 Chroma 把指定 ![]() DropShadow 建立 ![]() ![]() ![]() FlipH 水平反转 FlipV 垂直反转 Glow 为对象 ![]() Grayscale 降低图片 ![]() Invert 将色彩、饱和度以及亮度值完全反转建立底片效果 Light 在 ![]() Mask 为 ![]() Shadow 建立 ![]() ![]() ![]() Wave 在X轴和Y轴方向利用正弦波纹打乱图片 Xray 只显示对象 ![]() 下面分别阐述: 1、Alpha 滤镜 语法:{FILTER:ALPHA(opacity=opacity,finishopacity=finishopacity,style=style,startx=startx, starty=starty,finishx=finishx,finishy=finishy)} 'Alpha'属性是把 ![]() ![]() ![]() ![]() 就是 ![]() ![]() ![]() ![]() ![]() ![]() ![]() “opacity'代表透明度水准 ![]() ![]() ![]() ![]() ![]() ![]() ![]() 100代表完全不透明 ![]() ![]() ![]() ![]() ![]() 结束时 ![]() ![]() ![]() ![]() ![]() ![]() 、3代表长方形 ![]() ![]() ![]() FINISHX“和”FINISHY“代表渐变透明效果结束X和Y ![]() ![]() <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; char ![]() <title>css滤镜</title> <style> body{FILTER:ALPHA(opacity=50,finishopacity=80,style=2} </style> </head> <body> <div ![]() <div><img src="image/ch2.g ![]() </body> </html> 2、Blur 滤镜 语法:对于HTML:{filter:blur(add=add,direction=direction,strength=strength)} 对于Script语言: [oblurfilter=] object.filters.blur 用手指在 ![]() ![]() ![]() ![]() ![]() ![]() “ADD”参数是 ![]() ![]() ![]() 效果 ![]() ![]() ![]() ![]() ![]() ![]() 向上 ![]() ![]() ![]() ![]() ![]() ![]() ![]() 她代表有多少像素 ![]() ![]() ![]() 代码如下: <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; char ![]() <title>css滤镜</title> <style> body{filter:blur(add=ture,direction=135,strength=200)} </style> </head> <body> <div ![]() <div><img src="image/ch2.g ![]() </body> </html> 效果: 3、FlipH, FlipV 滤镜 语法:{filter:filph} ,{filter:filpv} 分别是水平反转和垂直反转 4、Chroma 滤镜 语法:{filter:chroma(color=color)} 使用”Chroma'属性可以设置 ![]() ![]() ![]() ![]() ![]() 代码如下: <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; char ![]() <title>css滤镜</title> <style> body{filter:chroma(color=#CC33C2)} </style> </head> <body> <div ![]() <div><img src="image/ch2.g ![]() </body> </html> 可以屏蔽颜色 ![]() ![]() 5、DropShadow 滤镜 语法:{filter:dropshadow(color=color,offx=ofx,offy=offy,positive=positive)} “DropShaow'顾名思义就是添加对象 ![]() ![]() ![]() ![]() ![]() 'Color'代表投射阴影 ![]() ![]() ![]() ![]() 'Positive'参数是 ![]() ![]() ![]() ![]() ![]() ![]() 如果为“FASLE(0)” ![]() ![]() dropshadow(color=gray,offx=5,offy=5.positive=0) 效果: 6、Glow 滤镜 语法:{filter:glow(color=color,strength)} 当对 ![]() ![]() ![]() ![]() ![]() 发光 ![]() ![]() ![]() ![]() ![]() ![]() filter:glow(color=red,strength=10) 后 ![]() filter:glow(color=#ffff00,strength=5) 后 ![]() <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; char ![]() <title>css滤镜</title> <style> body{filter:glow(color=red,strength=10)} .try{ margin-left:30px;} </style> </head> <body> <br /><br /> <div ![]() <br /> <div><img src="image/ch2.g ![]() </body> </html> 7、Gray ,Invert,Xray 滤镜 语法:{filter:gray} ,{filter:invert},{filter:xray} Gray滤镜是把 ![]() ![]() ![]() ![]() ![]() Invert滤镜是把对象 ![]() ![]() Xray滤镜是让对象反映出它 ![]() ![]() ![]() ![]() 效果: 效果: 8、Light 滤镜 语法:Filter{light} 这个属性模拟光源 ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ·AddAmbient 加入包围 ![]() ·AddCone 加入锥形光源 ·AddPo ![]() ·Changcolor 改变光 ![]() ·Changstrength 改变光源 ![]() ·Clear 清除所有 ![]() ·MoveLight 移动光源 addAmbient (iRed,iGreen,iBlue,iStrength) : 为滤镜添加环境光 ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() 常和其他光 ![]() ![]() ![]() ![]() iRed : 必选项 ![]() ![]() ![]() ![]() iGreen : 必选项 ![]() ![]() ![]() ![]() iBlue : 必选项 ![]() ![]() ![]() ![]() iStrength : 必选项 ![]() ![]() ![]() ![]() changeColor (iLightNumber,iRed,iGreen,iBlue,fAbsolute) : 改变光 ![]() ![]() ![]() ![]() iLightNumber : 必选项 ![]() ![]() ![]() ![]() iRed : 必选项 ![]() ![]() ![]() ![]() iGreen : 必选项 ![]() ![]() ![]() ![]() iBlue : 必选项 ![]() ![]() ![]() ![]() fAbsolute : 必选项 ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() 可以定义光源 ![]() ![]() ![]() ![]() ![]() ![]() ![]() 性 ![]() ![]() ![]() ![]() ![]() ![]() 实现图片自动变色效果 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; char ![]() <title>css滤镜</title> <style> body{} .try{ margin-left:30px;} </style> </head> <body> <br /><br /> <div ![]() <br /> <div><img src="image/ch2.g ![]() ![]() onmousemove="javascript:this.filters.light.changeColor(0,150,100,50,0)"/></div><br /><br /></div> </body> </html> 9、Mask 滤镜 语法:{filter:mask(color=color)} 使用'MASK'属性可以为对象建立 ![]() ![]() ![]() ![]() ![]() <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; char ![]() <title>css滤镜</title> <style> body{ filter:mask(color=yellow);} #try{ margin-left:30px;} </style> </head> <body> <br /><br /> <div id="try"><font color="#CC33C2">施杨de编程世界</font><br /> <br /> <div><img src="image/ch2.g ![]() </body> </html> 虽然实现 ![]() ![]() ![]() ![]() 10、Shadow 滤镜 语法:{filter:shadow(color=color,direction=direction)} 利用“Shadow”属性可以在指定 ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() 度 ![]() filter:shadow(color=red,direction=225) filter:shadow(color=blue,direction=225) filter:shadow(color=gray,direction=225) <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; char ![]() <title>css滤镜</title> <style> body{ filter:shadow(color=red,direction=225);} #try{ margin-left:30px;} </style> </head> <body> <br /><br /> <div id="try"><font color="#CC33C2">施杨de编程世界</font><br /> <br /> <div><img src="image/ch2.g ![]() </body> </html> 效果: 11、Wave 滤镜 语法:{filter:wave(add=add,freq=freq,lightstrength=strength,phase=phase,strength=strength)} 'wave' 属性把对象按垂直 ![]() ![]() ![]() “ADD”表示是否要把对象按照波形样式打乱 ![]() “FREQ”是波纹 ![]() ![]() ![]() ![]() ![]() “LIGHTSTRENGTH”参数可以对于波纹增强光影 ![]() ![]() ![]() “PHASE”参数用来设置正弦波 ![]() ![]() “STRENGTH”代表振幅大小 ![]() <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; char ![]() <title>css滤镜</title> <style> body{ filter:wave(add=add,freq=freq,lightstrength=strength,phase=phase,strength=20);} #try{ margin-left:30px;} </style> </head> <body> <br /><br /> <div id="try"><font color="#CC33C2">施杨de编程世界</font><br /> <br /> <div><img src="image/ch2.g ![]() </body> </html> 效果: jQuery弹出层源码: 页面: <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3c.org/TR/1999/REC-html401-19991224/loose.dtd"> <!-- saved from url=(0045)http:// ![]() <HTML xmlns="http://www.w3.org/1999/xhtml"> <HEAD><TITLE>Resizeable demo - Interface plugin for jQuery</TITLE> <META http-equiv=Content-Language content=en> <META http-equiv=Content-Type content="text/html; char ![]() <SCRIPT src="js/jquery.js" type=text/javascript></SCRIPT> <SCRIPT src="js/ ![]() type=text/javascript></SCRIPT> <link href="css/div_show.css" rel="stylesheet" type="text/css" media="all"> <META content="MSHTML 6.00.6000.16735" name=GENERATOR> </HEAD> <BODY><A id=windowOpen>管理员登陆</A> <DIV id=window> <DIV id=windowTop> <DIV id=windowTopContent>登陆界面</DIV> <IMG id=windowMin src="css/images/window_min.jpg"> <IMG id=windowMax src="css/images/window_max.jpg"> <IMG id=windowClose src="css/images/window_close.jpg"> </DIV> <DIV id=windowBottom> <DIV id=windowBottomContent></DIV></DIV> <DIV id=windowContent> <P></P> <P></P> <P></P> <P></P> <P></P> <P></P> <P></P> <P></P> <P></P> <P></P></DIV><IMG id=windowResize src="css/images/window_resize.g ![]() </DIV> <P></P> <P></P> <P></P> <P></P> <P></P> <P></P> <P></P> <P></P> <P></P> <P></P> <SCRIPT type="text/javascript" src="js/div_show.js"></SCRIPT> <SCRIPT language=JavaScript type=text/javascript>var client_id = 1;</SCRIPT> </BODY></HTML> css源码: BODY { BACKGROUND: #fff; HEIGHT: 100% } #window { DISPLAY: none; LEFT: 200px; OVERFLOW: hidden; WIDTH: 400px; POSITION: absolute; TOP: 100px; HEIGHT: 300px } #windowTop { BACKGROUND-POSITION: right top; BACKGROUND-IMAGE: url(images/window_top_end.png); OVERFLOW: hidden; CURSOR: move; BACKGROUND-REPEAT: no-repeat; POSITION: relative; HEIGHT: 30px } #windowTopContent { BACKGROUND-POSITION: left top; FONT-WEIGHT: bold; FONT-SIZE: 14px; BACKGROUND-IMAGE: url(images/window_top_start.png); OVERFLOW: hidden; COLOR: #6caf00; TEXT-INDENT: 10px; LINE-HEIGHT: 30px; MARGIN-RIGHT: 13px; BACKGROUND-REPEAT: no-repeat; FONT-FAMILY: Arial, Helvetica, sans-ser ![]() } #windowMin { RIGHT: 25px; CURSOR: po ![]() } #windowMax { DISPLAY: none; RIGHT: 25px; CURSOR: po ![]() } #windowClose { RIGHT: 10px; CURSOR: po ![]() } #windowBottom { BACKGROUND-POSITION: right bottom; BACKGROUND-IMAGE: url(images/window_bottom_end.png); BACKGROUND-REPEAT: no-repeat; POSITION: relative; HEIGHT: 270px } #windowBottomContent { BACKGROUND-POSITION: left bottom; BACKGROUND-IMAGE: url(images/window_bottom_start.png); MARGIN-RIGHT: 13px; BACKGROUND-REPEAT: no-repeat; POSITION: relative; HEIGHT: 270px } #windowResize { RIGHT: 3px; CURSOR: se-resize; BOTTOM: 5px; POSITION: absolute } #windowContent { BORDER-RIGHT: #6caf00 1px solid; BORDER-TOP: #6caf00 1px solid; FONT-SIZE: 11px; LEFT: 10px; OVERFLOW: auto; BORDER-LEFT: #6caf00 1px solid; WIDTH: 375px; MARGIN-RIGHT: 10px; BORDER-BOTTOM: #6caf00 1px solid; FONT-FAMILY: Arial, Helvetica, sans-ser ![]() } #windowContent * { MARGIN: 10px } .transferer2 { BORDER-RIGHT: #6baf04 1px solid; BORDER-TOP: #6baf04 1px solid; FILTER: alpha(opacity=30); BORDER-LEFT: #6baf04 1px solid; BORDER-BOTTOM: #6baf04 1px solid; BACKGROUND-COLOR: #b4f155; -moz-opacity: 0.3; opacity: 0.3 } js源码: $(document).ready( function ![]() { $('#windowOpen').bind( 'click', function ![]() ![]() ![]() $(this).TransferTo( { to:'window', ![]() duration: 400, complete: function ![]() { $('#window').show ![]() } } ); } this.blur ![]() ![]() } ); $('#windowClose').bind( 'click', function ![]() { $('#window').TransferTo( { to:'windowOpen', ![]() duration: 400 } ).hide ![]() } ); $('#windowMin').bind( 'click', function ![]() { $('#windowContent').SlideToggleUp(300); $('#windowBottom, #windowBottomContent').animate({height: 10}, 300); $('#window').animate({height:40},300).get(0).isMinimized = true; $(this).hide ![]() $('#windowResize').hide ![]() $('#windowMax').show ![]() } ); $('#windowMax').bind( 'click', function ![]() { var windowSize = $.iUtil.getSize(document.getElementById('windowContent')); $('#windowContent').SlideToggleUp(300); $('#windowBottom, #windowBottomContent').animate({height: windowSize.hb + 13}, 300); $('#window').animate({height:windowSize.hb+43}, 300).get(0).isMinimized = false; $(this).hide ![]() $('#windowMin, #windowResize').show ![]() } ); $('#window').Resizable( { minWidth: 200, minHeight: 60, maxWidth: 700, maxHeight: 400, dragHandle: '#windowTop', handlers: { se: '#windowResize' }, onResize : function(size, position) { $('#windowBottom, #windowBottomContent').css('height', size.height-33 + 'px'); var windowContentEl = $('#windowContent').css('width', size.width - 25 + 'px'); ![]() windowContentEl.css('height', size.height - 48 + 'px'); } } } ); } ); 再下载两个jquery ![]() ![]() ![]() 哦了 0
相关文章读者评论发表评论 |