CSS3圆角支持IE火狐Word格式.docx

上传人:b****5 文档编号:16143121 上传时间:2022-11-20 格式:DOCX 页数:12 大小:19.91KB
下载 相关 举报
CSS3圆角支持IE火狐Word格式.docx_第1页
第1页 / 共12页
CSS3圆角支持IE火狐Word格式.docx_第2页
第2页 / 共12页
CSS3圆角支持IE火狐Word格式.docx_第3页
第3页 / 共12页
CSS3圆角支持IE火狐Word格式.docx_第4页
第4页 / 共12页
CSS3圆角支持IE火狐Word格式.docx_第5页
第5页 / 共12页
点击查看更多>>
下载资源
资源描述

CSS3圆角支持IE火狐Word格式.docx

《CSS3圆角支持IE火狐Word格式.docx》由会员分享,可在线阅读,更多相关《CSS3圆角支持IE火狐Word格式.docx(12页珍藏版)》请在冰豆网上搜索。

CSS3圆角支持IE火狐Word格式.docx

10px;

border-radius:

10px;

behavior:

url(ie-css3.htc);

color:

#FFF;

}

/style>

如果要想在IE浏览器中实现圆角的效果,我们一般都会采用圆角图片的方式。

用图片的话,基本就跟浏览器没有多大关系了,因为任何浏览器都支持这种方式。

  本文我们主要是讲解如果用CSS3样式表来实现圆角效果,值得注意的是,IE6/7/8这三个IE浏览器版本都不支持CSS3的解析,只有还不太主流的IE9支持CSS3和HTML5的标准。

让IE支持CSS3的解析方法有很多种,下面介绍一种实用的让IE支持CSS3解析的方法——IE利用VML矢量可标记语言作为画笔绘出圆角:

  1、下载一个压缩包,里面有一个微软的脚本文件(11KB)和一个用来测试服务器是否有正确的Content-Type的HTML文件:

iecss3.rar;

.htc文件是IE内核支持Web行为后用来描述此类行为的脚本文件。

它们定义了一套方法和属性,程序员几乎可以把这些方法和属性应用到HTML页面上的任何元素上去。

Web行为是非常伟大的因为它们允许程序员把自定义的功能“连接”到现有的元素和控件,而不是必须让用户下载二进制文件(例如ActiveX控件)来完成这个功能。

  下载地址:

  解压后,打开test.html,如果显示效果是圆角,则可以继续。

  使用演示:

 

.main{ 

 

1.border:

2px 

solid 

#C0C0C0;

2.-moz-border-radius:

3. 

-webkit-border-radius:

4. 

border-radius:

5. 

position:

relative;

6. 

z-index:

2;

7. 

behavior:

url(ie-css3.htc);

8. 

  Webkit内核的浏览器支持“-webkit-border-radius:

”属性(10px是圆角半径),可以直接解析出圆角;

Firefox浏览器支持“-moz-border-radius:

”属性,也是可以直接解析出圆角;

IE系浏览器则需要加上“border-radius:

15px;

”的属性。

  注意:

  1、behavior的url里一定要填写ie-css3.htc的绝对路径,因为IE浏览器找该文件是相对当前html文件路径来找的,所以对于Wordpress等动态程序生成的页面一定要填写绝对路径。

  2、一定要有定位属性:

  3、因为在IE浏览器下这些CSS3效果的实现是要借助于VML,由VML绘制圆角或是投影效果,所以还需要一个z-index属性。

z-index属性最好设置得比较大,如2。

  4、如果在IE浏览器下某些模块无法用此渲染,可以试着绝对定位相应的层,即加上“width:

400px;

”属性。

  5、radius属性的10px是圆角半径,还可以给两个值如“border-radius:

10px5px;

”,这样则左上角与右下角半径为10px,右上角与左下角半径为5px。

也可以赋4个值,为“上右下左”。

附件:

ie-css3.htc

--Donotremovethisifyouareusing--

OriginalAuthor:

RemizRahnas

OriginalAuthorURL:

Publisheddate:

2008/09/24

ChangesbyNickFetchak:

-IE8standardsmodecompatibility

-VMLelementsnowpositionedbehindoriginalboxratherthaninsideofit-shouldbelesspronetobreakage

-Addedpartialsupportfor'

box-shadow'

style

-ChecksforVMLsupportbeforedoinganything

-UpdatesVMLelementsizeandpositionviatimerandalsoviawindowresizeevent

-lotsofothersmallthings

Publisheddate:

2010/03/14

ThankstoTheBrightL(forenlighteningmeabouttheDropShadowfilter

public:

attachevent="

ondocumentready"

onevent="

ondocumentready('

v08vnSVo78t4JfjH'

)"

/>

scripttype="

text/javascript"

timer_length=200;

//Milliseconds

border_opacity=false;

//Useopacityonbordersofrounded-cornerelements?

Note:

Thiscausesantialiasingissues

//supportsVml()borrowedfrom

functionsupportsVml(){

if(typeofsupportsVml.supported=="

undefined"

){

vara=document.body.appendChild(document.createElement('

div'

));

a.innerHTML='

v:

shapeid="

vml_flag1"

adj="

1"

'

;

varb=a.firstChild;

b.style.behavior="

url(#default#VML)"

supportsVml.supported=b?

typeofb.adj=="

object"

:

true;

a.parentNode.removeChild(a);

}

returnsupportsVml.supported

//findPos()borrowedfromhttp:

//www.quirksmode.org/js/findpos.html

functionfindPos(obj){

varcurleft=curtop=0;

if(obj.offsetParent){

do{

curleft+=obj.offsetLeft;

curtop+=obj.offsetTop;

}while(obj=obj.offsetParent);

return({

'

x'

curleft,

y'

curtop

});

functioncreateBoxShadow(element,vml_parent){

varstyle=element.currentStyle['

iecss3-box-shadow'

]||element.currentStyle['

-moz-box-shadow'

-webkit-box-shadow'

]||'

varmatch=style.match(/^(\d+)px(\d+)px(\d+)px/);

if(!

match){return(false);

varshadow=document.createElement('

roundrect'

);

shadow.userAttrs={

parseInt(RegExp.$1||0),

parseInt(RegExp.$2||0),

radius'

parseInt(RegExp.$3||0)/2

};

shadow.position_offset={

(0-vml_parent.pos_ieCSS3.y-shadow.userAttrs.radius+shadow.userAttrs.y),

(0-vml_parent.pos_ieCSS3.x-shadow.userAttrs.radius+shadow.userAttrs.x)

shadow.size_offset={

width'

0,

height'

0

shadow.arcsize=element.arcSize+'

px'

shadow.style.display='

block'

shadow.style.position='

absolute'

shadow.style.top=(element.pos_ieCSS3.y+shadow.position_offset.y)+'

shadow.style.left=(element.pos_ieCSS3.x+shadow.position_offset.x)+'

shadow.style.width=element.offsetWidth+'

shadow.style.height=element.offsetHeight+'

shadow.style.antialias=true;

shadow.className='

vml_box_shadow'

shadow.style.zIndex=element.zIndex-1;

shadow.style.filter='

progid:

DXImageTransform.Microsoft.Blur(pixelRadius='

+shadow.userAttrs.radius+'

makeShadow=true,shadowOpacity='

+el

展开阅读全文
相关资源
猜你喜欢
相关搜索

当前位置:首页 > 教学研究 > 教学计划

copyright@ 2008-2022 冰豆网网站版权所有

经营许可证编号:鄂ICP备2022015515号-1