1.动态计算宽高
width: 100%;
height: calc(100% - 40px); //-号两旁必须加空格
2.添加背景边框(4个小角角)
background: linear-gradient(to left, #23fff8, #23fff8) left top no-repeat,
linear-gradient(to bottom, #23fff8, #23fff8) left top no-repeat,
linear-gradient(to left, #23fff8, #23fff8) right top no-repeat,
linear-gradient(to bottom, #23fff8, #23fff8) right top no-repeat,
linear-gradient(to left, #23fff8, #23fff8) left bottom no-repeat,
linear-gradient(to bottom, #23fff8, #23fff8) left bottom no-repeat,
linear-gradient(to left, #23fff8, #23fff8) right bottom no-repeat,
linear-gradient(to left, #23fff8, #23fff8) right bottom no-repeat;
background-size: 6px 60px, 60px 6px, 6px 60px, 60px 6px;

CSS技巧:动态尺寸与背景边框
本文介绍如何使用CSS的calc函数动态计算元素的宽度和高度,并演示了一个复杂的背景边框效果实现方法,通过多个线性渐变叠加来创建独特的四角装饰。
1555

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



