ThinkChat2.0新版上线,更智能更精彩,支持会话、画图、阅读、搜索等,送10W Token,即刻开启你的AI之旅 广告
### 多重边框:box-shadow 贴合圆角,任意数量,实线边框(个人习惯:添加inset,然后通过padding添加box-shadow所需的空间,因为box-shadow并不会影响布局,不占据空间,放在外围无法响应事件) ``` <style> div{ width: 200px; height: 200px; background-color: yellowgreen; margin: 20px auto; padding: 20px; box-shadow: 0 0 0 10px #655 inset,0 0 0 20px deeppink inset; } </style> <div></div> ``` ### 双层边框:outline 不贴合圆角,跟边框加起来最多两层,边框样式灵活,跟border写法一致,不占据盒子模型空间,可设置outline-offset负值实现内嵌(缝边效果) ``` <style> div{ width: 200px; height: 200px; background-color: yellowgreen; margin: 20px auto; border: 10px solid #665; outline: 10px solid deeppink; } </style> <div></div> ``` ``` <style> div{ width: 200px; height: 200px; background-color: #333; margin: 20px auto; outline: 1px dashed #fff; outline-offset: -10px; } </style> <div></div> ```