移动端border:1px 解决办法

本文介绍了一种使用Sass实现响应式1px视觉效果的边框技巧,通过伪元素结合媒体查询来适配不同设备像素比,确保在高清屏幕上也能保持良好的显示效果。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

sass写法

@mixin border-1px ($color) {
	position:relative;
	&::after{
		diplay:block;
		position:absolute;
		content:"";
		left:0;
		bottom:0;
		width:100%;
		border-top:1px solid $color;
	}
	@media(-webkit-min-device-pixel-ratio:1.5),(min-device-pixel-ratio:1.5){
		&::after{
			-webkit-transform:scaleY(0.7);
			transform:scaleY(0.7);
		}
	}
	@media(-webkit-min-device-pixel-ratio:2),(min-device-pixel-ratio:2){
		&::after{
			-webkit-transform:scaleY(0.5);
			transform:scaleY(0.5);
		}
	}
}
.ce{
	@include border-1px(red)
}

<!doctype html> <html> <head> <meta charset="utf-8"> <link href="css/bootstrap.min.css" rel="stylesheet" type="text/css"> <link href="css/bootstrap-table.css" rel="stylesheet" type="text/css"> <link href="css/zTreeStyle/zTreeStyle.css" rel="stylesheet" type="text/css" /> <link rel="stylesheet" href="css/base.css" /> <link rel="stylesheet" href="css/info-mgt.css" /> <style> .tree_left{box-sizing:border-box;overflow-y: auto;width:76%;border: 1px #ccc solid;;border-radius: 6px;margin-right: 1%;margin-left: 90px;height: 400px;} .tree_left_top{margin: 6px} .tree_input input{border: 1px #ccc solid;margin:3px 0 0 10px;border-radius: 4px; } .layui-layer-title{background:url(images/righttitlebig.png) repeat-x;font-weight:bold;color:#46647e; border:1px solid #c1d3de;height: 33px;line-height: 33px;} .tabe_bot label,.right label{width: 70px;text-align: right;font-size: 14px;font-weight: 900;color: #46647e} .l_left{float: left} .tabe_bot input,.tabe_bot select,.right input,.right input{width: 180px;height: 30px;border-radius: 6px;margin:0 20px 0 0;border: none;border: 1px #ccc solid} .tabe_btn{width: 60px;height: 30px;background-color: #68b86c;border: none;border-radius: 6px;color: #fff} .right{width: 39%;border: 1px #c1d3de solid;border-top: none} .right textarea{width: 80%;height: 60px;resize: none;border-radius: 6px;margin-bottom: 20px;border: 1px #ccc solid} .bot_btn{width: 150px;height: 30px;margin: 20px 0 0 40%} .bot_btn .btn{width: 60px;height: 30px;background-color: #68b86c;border: none;border-radius: 6px;color: #fff;margin-right: 15px} .bot_btn .btn1{background-color: #c1d3de;border: none;border-radius: 6px;color: #000;margin-right: 0} </style> <title>角色管理</title> </head> <body onload="change(),Roleload()"> <div class="title"><h2>角色管理</h2></div> <div class="l_left" style="width: 60%;margin-right: 1%"> <div class="query">
03-26
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值