<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Title</title>
</head>
<body>
<script>
var str = ` <!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width">
<title>我的银行卡</title>
<style>
*{
margin:0;
padding:0;
}
body{
width:100%;
background: #eee;
}
header{
box-sizing: border-box;
width:375px;
height:75px;
font-size:20px;
font-weight:bold;
font-family: PingFangSC-Regular,Arial,sans-serif ;
text-align:center;
line-height:75px;
}
section{
width:100%;
height:auto;
overflow: hidden;
box-sizing: border-box;
}
.bg{
background:#388dcf;
}
.bg2{
background:lightblue;
}
section .item{
width:343px;
height:175px;
margin:0 auto;
box-sizing: border-box;
border-radius:7.5px;
padding: 16px 17px 17px 12px;
display:flex;
flex-direction: column;
justify-content: space-between;
margin-bottom:15px;
}
.pull-left{
float:left;
}
.clear{
clear:both;
}
.pull-right{
float:right;
}
.top .logo{
width: 39px;
height:39px;
border-radius: 50%;
}
.top .title{
color:white;
}
.top .title .bank{
font-size:17px;
font-weight: 600;
line-height:17px;
}
.top .title .card-type{
font-size:14px;
padding-top:4px;
}
.top .cardID{
padding-top:8px;
color:white;
font-family: PingFangSC-Regular, Arial, sans-serif ;
font-weight: bold;
font-size: 16px;
font-weight:550;
}
.bottom{
color:white;
text-align:right;
font-size: 14px;
}
.hide{
color: #afc4e6;
}
.jianhang{
background: linear-gradient(to bottom right, #398cce, #3864be);
box-shadow: 0px 0px 3px #3864be;
}
.zhaoshang{
background: linear-gradient(to bottom right, #ff7566, #ff5262);
box-shadow: 0px 0px 3px #ff5262;
}
.wangshang{
background: linear-gradient(to bottom right, #01aa9a, #028caf);
box-shadow: 0px 0px 3px #028caf;
}
.nonghang{
background: linear-gradient(to bottom right, #438A4E, #0C4139);
box-shadow: 0px 0px 3px #0C4139;
}
.jiaotong{
background: linear-gradient(to bottom right, #A49264, #A58671);
box-shadow: 0px 0px 3px #A58671;
}
</style>
</head>
<body>
<header>我的银行卡</header>
<section>
<div class="item jianhang">
<div class="top">
<div class="title pull-left">
<div class="bank">建设银行</div>
<div class="card-type">储蓄卡</div>
</div>
<div class="cardID pull-right"><span class="hide">****</span> <span>9527</span></div>
</div>
<div ></div>
<div class="bottom">
每日支付限额 10000 元
</div>
</div>
<div class="item zhaoshang">
<div class="top">
<div class="title pull-left">
<div class="bank">招商银行</div>
<div class="card-type">信用卡</div>
</div>
<div class="cardID pull-right"><span class="hide">****</span> <span>4396</span></div>
</div>
<div ></div>
<div class="bottom">
每日支付限额 20000 元
</div>
</div>
<div class="item wangshang">
<div class="top">
<div class="title pull-left">
<div class="bank">网商银行</div>
<div class="card-type">银行账户</div>
</div>
<div class="cardID pull-right"><span class="hide">****</span> <span>1024</span></div>
</div>
<div ></div>
<div class="bottom">
每日支付限额 40000 元
</div>
</div>
<div class="item nonghang">
<div class="top">
<div class="title pull-left">
<div class="bank">农业银行</div>
<div class="card-type">储蓄卡</div>
</div>
<div class="cardID pull-right"><span class="hide">****</span> <span>8848</span></div>
</div>
<div ></div>
<div class="bottom">
每日支付限额 80000 元
</div>
</div>
<div class="item jiaotong">
<div class="top">
<div class="title pull-left">
<div class="bank">交通银行</div>
<div class="card-type">储蓄卡</div>
</div>
<div class="cardID pull-right"><span class="hide">****</span> <span>1987</span></div>
</div>
<div ></div>
<div class="bottom">
每日支付限额 80000 元
</div>
</div>
</section>
</body>
</html> `
// 正则替换
var res = str.replace(/(\d+)px/g,function(val,group){
return group / 100 + 'rem'
})
console.log(res)
</script>
</body>
</html>
正则替换 px 转换 rem
原创wg_iGBFcBFB 博主文章分类:移动端 ©著作权
©著作权归作者所有:来自51CTO博客作者wg_iGBFcBFB的原创作品,请联系作者获取转载授权,否则将追究法律责任
提问和评论都可以,用心的回复会被更多人看到
评论
发布评论
相关文章
-
sed命令n,N,d,D,p,P,h,H,g,G,x解析
linux sed n N d D h H g G 命令区别
linu sed n N d D h H g G -
5G关键技术之D2D
机制,以确保未来可以很好的与其它5G 技术整合、协调。下面简单介绍通过5G
5G D2D hslogic 2d 物联网 -
Android px转dip px转sp法则
Android px转dip或sp
Android 移动开发 px转dp px转dip px转sp