设置根元素的字体为62.5%,1rem 等于10px;
html{
font-size:62.5%
}
Bottom1px {
width: 100%;
height: 10rem;
position: relative;
}
.Bottom1px:after {
content: '';
display: block;
position: absolute;
width: 100%;
left: 0; bottom: 0;
height: 1px;
background-color: #c8c7cc;
transform: scaleY(0.5);
}
CSS单位与视口比例
本文介绍了一种使用百分比设置根元素字体大小的方法,使得1rem等于10px,便于响应式布局的设计。通过具体代码示例展示了如何实现底部1像素线条的效果。
557

被折叠的 条评论
为什么被折叠?



