例如:border-radius:10px第二、四个圆角贴图;制作四个圆角的图片,然后用css定义
第三、直接制作整个矩形背景。总归而言,第一种方式最简单,只要一行代码。
<!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">
<body>
<div id="d_bx" style="position:absoluteleft:320pxtop:240pxwidth:150pxheight:50pxborder:1px solid #0000ff">
<img src="http://img.baidu.com/img/logo-zhidao.gif" />
</div>
<script type="text/javascript">
var isIE=/msie/i.test(navigator.userAgent) &&!window.opera
var O_bx=G('d_bx')
var bx_R=G_R(O_bx)
var R_jd=0
var R_tim=setInterval(R_ote, 50)
function G(t){return document.getElementById(t)}
function R_ote(){
R_jd+=10if(R_jd>360){R_jd-=360}
if(isIE){R_otie(R_jd)}else{O_bx.style[bx_R]='rotate('+R_jd+'deg)'}
}
function R_otie(d_j){
var d_h=d_j * Math.PI / 180
var m_c=Math.cos(d_h), m_s=Math.sin(d_h)
O_bx.style.filter='progid:DXImageTransform.Microsoft.Matrix(M11='+m_c+',M12='+(-m_s)+',M21='+m_s+',M22='+m_c+',SizingMethod="auto expand")'
}
function G_R(t_o){
var t_O=t_o.style
if(t_O.webkitTransform !== undefined){//Chrome Safari
return 'webkitTransform'
}else if(t_O.MozTransform !== undefined){//Mozilla
return 'MozTransform'
}else if(t_O.OTransform !== undefined){//Opera
return 'OTransform'
}else{
return 'transform'
}
}
</script>
</body>
</html>
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)