We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
推荐使用的方法:伪类 + transform 原理是把原先元素的 border 去掉,然后利用 :before 或者 :after 重做 border ,并 transform 的 scale 缩小一半,原先的元素相对定位,新做的 border 绝对定位
单条 border
.hairlines li{ position: relative; border:none; } .hairlines li:after{ content: ''; position: absolute; left: 0; background: #000; width: 100%; height: 1px; -webkit-transform: scaleY(0.5); transform: scaleY(0.5); -webkit-transform-origin: 0 0; transform-origin: 0 0; }
四条 border
.hairlines li{ position: relative; margin-bottom: 20px; border:none; } .hairlines li:after{ content: ''; position: absolute; top: 0; left: 0; border: 1px solid #000; -webkit-box-sizing: border-box; box-sizing: border-box; width: 200%; height: 200%; -webkit-transform: scale(0.5); transform: scale(0.5); -webkit-transform-origin: left top; transform-origin: left top; }
样式使用的时候,也要结合 JS 代码,判断是否 Retina 屏 可以支持圆角,唯一的一点小缺陷是 用不了。
if(window.devicePixelRatio && devicePixelRatio >= 2){ document.querySelector('ul').className = 'hairlines'; } `
The text was updated successfully, but these errors were encountered:
No branches or pull requests
移动设备实现1px的线
推荐使用的方法:伪类 + transform
原理是把原先元素的 border 去掉,然后利用 :before 或者 :after 重做 border ,并 transform 的 scale 缩小一半,原先的元素相对定位,新做的 border 绝对定位
单条 border
四条 border
样式使用的时候,也要结合 JS 代码,判断是否 Retina 屏
可以支持圆角,唯一的一点小缺陷是 用不了。
The text was updated successfully, but these errors were encountered: