Skip to content
New issue

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

hairlines的样式类在哪里 #152

Closed
haoxunba opened this issue Aug 30, 2017 · 1 comment
Closed

hairlines的样式类在哪里 #152

haoxunba opened this issue Aug 30, 2017 · 1 comment

Comments

@haoxunba
Copy link

在这段代码里面要添加hairlines的样式类,但是我没有找到对应的类样式

// detect 0.5px supports
  if (dpr >= 2) {
    var fakeBody = document.createElement('body')
    var testElement = document.createElement('div')
    testElement.style.border = '.5px solid transparent'
    fakeBody.appendChild(testElement)
    docEl.appendChild(fakeBody)
    if (testElement.offsetHeight === 1) {
      docEl.classList.add('hairlines')
    }
    docEl.removeChild(fakeBody)
  }
@airen
Copy link
Contributor

airen commented Aug 31, 2017

代码检测到如果你的值是1px会在选择前器添加一个类名。也可以通过PostCSS处理器来控制,让1px的添加这个类名。其实使用PostCSS-write-svg能很好的处理1px的问题。我在《再聊移动端的适配》一文中有提到:https://www.w3cplus.com/css/vw-for-layout.html 另外现在对vw之类的支持很好了。我们测试过top30以上的机型。

@airen airen closed this as completed Aug 31, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants