解析DIV style中特殊效果的实现

开发 前端
上节向大家介绍了DIV Style的常用属性,本文向大家介绍一下DIV style一些特殊效果,相信本文介绍一定会让你有所收获。

本文向大家描述一下DIV style一些特殊效果,主要包括cursor:设置DIV上光标的样式,filter:滤镜效果以及其他效果。

DIV style一些特殊效果

1、cursor:设置DIV上光标的样式。

2、clip:设置剪辑矩形。

例:

代码

  1. <div style="font:16px宋体;width:600px;height:200px;  
  2. cursor:help;clip:rect(0px100px20px0px);  
  3. line-height:20px;overflow:auto;  
  4. background-color:Yellow;position:absolute">div样式测式howareyou.</div> 
  5.  

说明:clip:rect(toprightbottomleft);设置上下左右的距离,但此时要把position指定为absolute。看以上效果。

3、filter:滤镜效果。

例:

代码

  1. <div style="width:450px;height:200px;  
  2. background-color:Blue;"> 
  3. <dividdivid=”tdiv”style="background-color:Yellow;  
  4.  
  5. filter:alpha(opacity=50);opacity:0.5;float:left;width:200px;  
  6. height:200px;"> 
  7. </div><div style="background-color:Yellow;  
  8. width:200px;height:200px;float:left;"></div> 
  9. </div> 
  10.  

说明:设置透明度:opacity:value(FF专用,value的取值为0至1之间的小数),filter:alpha(opacity=value)(IE专用,value取值:0至100)。

如果要有JavaScript改变DIV的透明度可用下面的方法:

FF中:document.getElementById('tdiv').style.opacity='0.9';

IE中:document.getElementById('tdiv').style.filter='alpha(opacity=90)';

*以下是滤镜综合的例子,将以下代码复制到一个网页文件中就可看到其效果,所以就不要加以说明了。

例: 

  1. <styletypestyletype="text/css"> 
  2.  
  3. #paneldivdiv  
  4.  
  5. {  
  6.  
  7. background-Color:yellow;  
  8.  
  9. height:200px;  
  10.  
  11. width:200px;  
  12.  
  13. }  
  14.  
  15. </style> 
  16.  
  17. <dividdivid="paneldiv"style="width:230px;height:2300px;  
  18.  
  19. background-color:Blue;"> 
  20.  
  21. <div style="filter:alpha(opacity=0,finishopacity=80,style=1,  
  22.  
  23. startx=10,starty=10,FinishX=100,FinishY=100);  
  24. opacity:0.5;"> 
  25.  
  26. chroma效果:<br/> 
  27.  
  28. 原为黄色,单击变成红色变成透明,双击变成黑色。  
  29.  
  30. </div> 
  31.  
  32. <div style="filter:FlipH;"> 
  33.  
  34. glow效果:<br/> 
  35.  
  36. strength的光的强度0--100;此时不能设DIV的背景色。  
  37.  
  38. </div> 
  39.  
  40. <div style="filter:mask(color='ff0000');width:100px;  
  41.  
  42. height:100px;text-transform:uppercase;color:black;"> 
  43.  
  44. mask效果:<br/> 
  45.  
  46. 没有明显效果,不能设背景色。  
  47.  
  48. </div> 
  49.  
  50. <div style="filter:shadow(color='0000ff',direction='100');  
  51.  
  52. width:100px;height:100px;"> 
  53.  
  54. </div>   

【编辑推荐】

  1. DIV style常用属性
  2. IE6.0对padding的解读分析
  3. 揭露CSS中margins折叠现象内幕
  4. 七大CSS选择符用法说明
  5. 技术分享 如何使用CSS控制超链接文字样式

 

责任编辑:佚名 来源: cnblogs.com
相关推荐

2010-09-10 09:57:27

DIV样式

2009-12-29 14:26:04

WPF按钮

2009-12-25 14:25:39

WPF图标

2010-08-17 10:16:37

DIV样式

2015-07-08 16:19:17

iOSUIVisualEff

2010-08-24 13:55:38

DIVstyle

2010-09-07 09:30:25

DIV弹出jQuery

2010-09-14 12:58:41

DIV+CSS圆角

2010-08-25 13:48:51

CSSlist-style-

2009-12-23 17:31:56

WPF Style

2010-09-14 09:18:28

DIVCSS

2010-08-03 11:29:09

Flex全屏

2011-09-01 13:17:46

JQuery滚动

2010-09-10 09:51:05

DIVCSS

2015-07-07 10:15:56

iOSUIVisualEffweak

2017-02-06 13:31:19

Android样式继承关系

2010-08-30 10:09:07

JavaScriptDIV

2010-08-17 11:12:18

DIV CSS

2010-09-09 11:16:06

CSS交互

2009-12-18 15:56:05

Ruby特殊语法
点赞
收藏

51CTO技术栈公众号