当前位置: 首页 > Web前端 > CSS

[CSS]《CSS揭秘》第二章—背景与边框

时间:2023-03-30 17:55:03 CSS

半透明边框border:10pxsolidhsla(0,0%,100%,.5);背景:白色;背景剪辑:填充框;相关语法:background-clip:border-box|padding-box|content-box;多边框框阴影方案box-shadow:00010pxred,00015pxgreen,02px5px20pxwhite;*:required注意上面创建的边框是伪边框,不响应鼠标事件。轮廓方案(只能创建双边框)border:5pxsolidred;轮廓:10px纯绿色;背景定位background-positionschemebackground:url(2.jpg)no-repeat;宽度:100%;高度:100%;background-position:right10pxbottom10px;*:当只有background-image时,需要设置basesize,否则不显示,因为背景图不会展开div。background-origin方案background-position默认基于padding-box,可以通过background-origin设置为content-box。calcschemebackground:url(2.jpg)no-repeat;background-position:calc(100%-10px)calc(100%-10px);*:计算以左上角为基准。**:calc中加减法前后必须有空格,这是为了向前兼容。边框颜色:白色;背景:黑色;边界半径:.8em;填充:1em;盒子阴影:000.6em红色;轮廓:.6em纯红色;stripebackgroundhorizo??ntalstripebackground:linear-gradient(gray30%,pink70%);//gradientbackground:linear-gradient(gray30%,pink30%);//无渐变*:如果我们设置的位置值为第二个色标为0,那么它的色标位置总会被浏览器调整到前一个色标的位置值。竖条纹(重复)背景:linear-gradient(90deg,red50%,blue0);背景大小:50%100%;斜条纹背景:repeating-linear-gradient(60deg,#fb30px,#fb315px,#58a15px,#58a30px);//角度,条纹1的渐变色1的起点,渐变色的终点条纹1的2,条纹2的渐变色1的起点,条纹2的渐变色2的终点;同色条纹背景:#58a;背景图像:重复线性渐变(30deg,hsla(0,0%,100%,.1),hsla(0,0%,100%,.1),15px,透明0,透明30px);复杂背景图案网格背景:#58a;背景图像:线性渐变(90deg,rgba(200,0,0,.5)50%,透明0),线性渐变(rgba(200,0,0,.5)50%,透明0);背景大小:30px30px;圆点背景:#655;背景:径向渐变(棕褐色30%,透明0),径向渐变(棕褐色30%,透明0);;背景尺寸:30px30px;background-position:00,15px15px;*:为了达到效果,第二层的偏移量必须是patch宽度的一半。Imagebordercontinuousimageborderpadding:1em;border:1em实心透明;背景:线性渐变(白色,白色),url(./2.jpg);背景尺寸:封面;背景剪辑:填充框,边框框;background-origin:border-box;*:background-clip属性指定了背景的绘制区域。复古信封填充:1em;边框:16px实心透明;border-image:16repeating-linear-gradient(-45deg,red0,red1em,transparent0,t??ransparent2em,#58a0,#58a3em,transparent0,t??ransparent4em);