遇到css last-child 不生效 问题,记录下来
- 子元素需要同一个父元素包裹
![[外链图片转存失败,源站可能有防盗链机制,建议将图片保存下来直接上传(img-22llYzCK-1626436450089)(https://note.youdao.com/yws/res/13510/WEBRESOURCE154f767515d4f09d5f0b40317fcae439)]](https://i-blog.csdnimg.cn/blog_migrate/108700f732bc1dcbc2ac27480eac99f0.png)
发现 0.5像素边框实现方法,记录下来
<div class="border">0.5像素边框~~~~</div>
<style>
.border {
width: 200px;
height: 200px;
margin: 0 auto;
position: relative;
}
.border::before {
content: " ";
position: absolute;
top: 0;
left: 0;
width: 200%;
height: 200%;
border: 1px solid red;
transform-origin: 0 0;
transform: scale(0.5);
}
</style>
效果:
![[外链图片转存失败,源站可能有防盗链机制,建议将图片保存下来直接上传(img-ZbFVS2xR-1626436450093)(https://note.youdao.com/yws/res/13518/WEBRESOURCE5ab7f7f2862cdd08f18bb936f86217e5)]](https://i-blog.csdnimg.cn/blog_migrate/72517e15d0b5f2c73febba160834608f.png)
参考资料: https://segmentfault.com/a/1190000020640155
3690

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



