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
整理一下 CSS 相对长度
<style> .par { font-size: 16px; } .chi { font-size: 2em; padding: 2em; } </style> <div class="par"> cdcdcdcdcdc <div class="chi"> dcdcdc </div> </div>
div.chi computed:
如果给一个元素加上 font-size: 2vw 会发生什么? 在一个 1200px 的桌面显示器上,计算值为 24px(1200 的 2%)。在一个 768px 宽的平板上,计算值约为 15px(768 的 2%)。这样做的好处在于元素能够在这两种大小之间平滑地过渡,这意味着不会在某个断点突然改变。当视口大小改变时,元素会逐渐过渡 。 不幸的是,24px 在大屏上来说太大了。更糟糕的是,在 iPhone 6 上会缩小到只有 7.5px 0.5em 保证了最小字号,1vw 则确保 了字体会随着视口缩放。这段代码保证基础字号从 iPhone 6 里的 11.75px 一直过渡到 1200px 的浏 览器窗口里的 20px。可以按照自己的喜好调整这个值: :root { font-size: calc(0.5em + 1vw); }
:root { font-size: calc(0.5em + 1vw); }
https://www.manning.com/books/css-in-depth
The text was updated successfully, but these errors were encountered:
No branches or pull requests
整理一下 CSS 相对长度
em
div.chi computed:
rem
视口的相对单位
The text was updated successfully, but these errors were encountered: