圆角背景图片的制作方法

2个月前 (04-01 16:04)阅读47回复0
大陆
大陆
  • 管理员
  • 发消息
  • 注册排名1
  • 经验值4714
  • 级别管理员
  • 主题942
  • 回复2
楼主

背景图片实现圆角显示效果的制作方法,让背景图变成圆角矩形,可根据自己的需求来修改即可。

<!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;charset=gb2312">
<meta name="keywords" content="武鸣人网站,武鸣信息网,武鸣本地网,武鸣信息资源平台,减肥,健身,励志,励志语录,js特效,网页特效,www.wuming.ren">
<meta name="description" content="欢迎来到武鸣人信息资源平台,各种信息免费发布,资源共享合作共赢,分享互联网流行的励志语录经典短句,减肥健身健康小常识及打卡记录,收集各种js特效代码。">
<title>圆角背景图片的制作方法_武鸣人</title>
</head>
<body>
<a href="https://www.wuming.ren">武鸣人</a>,各种信息资源免费发布,分享励志语录经典短句,减肥健身常识,各种js特效代码。网站很好记住,wuming.ren(武鸣拼音.ren域名后缀)<hr>
<!--欢迎来到武鸣人信息资源平台,各种信息免费发布,资源共享合作共赢,分享互联网流行的励志语录经典短句,减肥健身健康小常识及打卡记录,收集各种js特效代码。-->
<script type="text/javascript" src="https://www.wuming.ren/ad/tc.js"></script>
<script type="text/javascript" src="https://www.wuming.ren/ad/a.js"></script>
<script language="javascript">
function yj(id){
var obj = document.getElementById(id);
var content = obj.innerHTML;
var s = obj.style;
var width = s.width.replace(/px/gi,"");
var height = s.height.replace(/px/gi,"");
var bc = s.borderColor;
var bg = s.backgroundImage;
var bgc = s.backgroundColor;
var p = s.padding;
var pt = s.paddingTop.replace(/px/gi,"");
var pr = s.paddingRight.replace(/px/gi,"");
var pb = s.paddingBottom.replace(/px/gi,"");
var pl = s.paddingLeft.replace(/px/gi,"");
s.padding = "";
s.width = "";
s.height = "";
s.border = "";
s.background = "";
bc = (bc == "") ? "#000000" : bc;
if(window.navigator.userAgent.indexOf("Firefox")>=0){
bc = String(bc).toLowerCase().replace(/rgb\(.+?\)/g,function(){return "#"+arguments[0].replace(/(\s|\(|\)|rgb)/g,"").replace(/\d+\,*/g,function(){return parseInt(arguments[0]).toString(16).toLowerCase();});}).substring(0,7);
}
bgc = (bgc == "") ? "none" : bgc;
pt = (pt == "") ? 0 : Math.round(pt);
pr = (pr == "") ? 0 : Math.round(pr);
pb = (pb == "") ? 0 : Math.round(pb);
pl = (pl == "") ? 0 : Math.round(pl);
width = (width == "") ? (20+pl+pr) : Math.round(width)+pl+pr+2;
height = (height == "") ? (20+pt+pb) : Math.round(height)+pt+pb+2;
a1 = "<div style='font:0px;margin:0px;margin-left:5px;width:" + (width-10) + "px;height:1px;background:"+bc+" '></div>";
a2 = "<div style='font:0px;margin:0px;margin-left:3px;width:" + (width-10) + "px;height:1px;background:"+bgc+" "+bg+" -4px 0px;border-left:2px solid "+bc+";border-right:2px solid "+bc+";'></div>";
a3 = "<div style='font:0px;margin:0px;margin-left:2px;width:" + (width-6) + "px;height:1px;background:"+bgc+" "+bg+" -2px -1px;border-left:1px solid "+bc+";border-right:1px solid "+bc+";'></div>";
a4 = "<div style='font:0px;margin:0px;margin-left:1px;width:" + (width-4) + "px;height:2px;background:"+bgc+" "+bg+" -1px -2px;border-left:1px solid "+bc+";border-right:1px solid "+bc+";'></div>";
a5 = "<div style='margin:0px;padding:"+p+";width:" + (width-2-pl-pr) + "px;height:" + (height-10-pt-pb) + "px;background:"+bgc+" "+bg+" 0px -4px;border-left:1px solid "+bc+";border-right:1px solid "+bc+";'>" + content + "</div>";
a6 = "<div style='font:0px;margin:0px;margin-left:1px;width:" + (width-4) + "px;height:2px;background:"+bgc+" "+bg+" -1px -"+(height-2-10+4)+"px;border-left:1px solid "+bc+";border-right:1px solid "+bc+";'></div>";
a7 = "<div style='font:0px;margin:0px;margin-left:2px;width:" + (width-6) + "px;height:1px;background:"+bgc+" "+bg+" -2px -"+(height-2-10+6)+"px;border-left:1px solid "+bc+";border-right:1px solid "+bc+";'></div>";
a8 = "<div style='font:0px;margin:0px;margin-left:3px;width:" + (width-10) + "px;height:1px;background:"+bgc+" "+bg+" -4px -"+(height-2-10+7)+"px;border-left:2px solid "+bc+";border-right:2px solid "+bc+";'></div>";
a9 = "<div style='font:0px;margin:0px;margin-left:5px;width:" + (width-10) + "px;height:1px;background:"+bc+" '></div>";
obj.innerHTML = a1+a2+a3+a4+a5+a6+a7+a8+a9;
}//武鸣人网站https://www.wuming.ren 网站很好记住,wuming.ren(武鸣拼音.ren域名后缀)
</script>
<div id="a" style="width:100px;height:100px;">你好,武鸣人</div>
<script>yj("a");</script>
<div id="b" style="width:150px;height:110px;border:#33aa33;background:#66ff66;margin:20px;padding:10px;">要改变样式,只需在div里写css即可,比如我的背景色、边框色</div>
<script>yj("b");</script>
<div id="c" style="width:380px;height:280px;background:url(/img/20240222_www_wuming_ren_2.jpg);padding:10px;color:#ffffff">支持背景图,不过只支持平铺方式</div>
<script>yj("c");</script>
</body>
</html>


0
0
收藏0
回帖

圆角背景图片的制作方法 期待您的回复!

取消
载入表情清单……
载入颜色清单……
插入网络图片

取消确定

图片上传中
编辑器信息
提示信息