css的属性和样式

202 阅读3分钟

圆角边框:radius (半径的意思) 写四个值按照顺时针顺序:(对角) 写3个值 左上角0 右上角0 左下角30px 右下角50px 写2:左右上下角30px 右上右下50px ① 元素的宽度和高度必须相同

② 圆角的半径为元素宽度的一半,或者直接设置圆角半径值为50%

盒子阴影:box-shadow:默认是外阴影。设置inset就是内阴影 x轴距离 y轴距离 模糊半径的大小,模糊的颜色 none没有样式

box-shadow:inset(阴影类型内阴影,不设置的话就是外阴影) x-offset(x轴位移,指定阴影水平位移量) y-offset (阴影模糊半径阴影向外模糊的模糊范围)blur-radius color(阴影颜色,定义绘制阴影时所使用的的颜色)

例如: 情况一:(此时有inset)

div{ margin: 20px auto; width: 200px; height: 200px; background-color: lightskyblue; box-shadow: inset 10px 10px 3px blue; } 情况二:(此时没有inset)

div{ margin: 20px auto; width: 200px; height: 200px; background-color: lightskyblue; box-shadow: 10px 10px 3px black; } 情况三:(此时应有inset值的地方值为0)

div{ margin: 20px auto; width: 200px; height: 200px; background-color: lightskyblue; box-shadow: 0 10px 10px 3px black; }

情况四:(此同时有内阴影和外阴影)

div{ margin: 20px auto; width: 200px; height: 200px; background-color: lightskyblue; box-shadow: inset 10px 10px 3px blue, 10px 10px 3px black; }

ul li 的默认样式:list-style-type简写list-style list-style-type:cirle空心圆 decimal数字序号(相当于有序列表) desc实心圆 (默认的) disclosure-closed右箭头(树形图的关闭箭头) disclosure-open下箭头(树形图的打开箭头)

test-indent不会改变盒子的显示大小,而padding-left会

background-sizin属性

当图片小于边框 想让图片沾满边框的情况:第一种:设置宽高:background-siz:宽度 高度; 如果只给一个值,第二个值用auto,auto会隐藏一部分,不能完全展示图片

第二种:设置百分比:background-siz:100% 100%;需要写2个100%,因为一个值,另外一个auto会隐藏部分

第三种:cover :保持图像的纵横比将图像缩放成将完全覆盖背景定位区域,也会隐藏, 但是边框整体不会压缩变形

第三种:contain:保持图像的纵横比将图像缩放成将适合覆盖背景定位区域,

一般最好用第二种百分比

css的线形渐变:
从上而下 background: linear-gradient( to bottom,red, green;) 从下而上 background: linear-gradient (to top,red, green);

从左到右

background: linear-gradient(to right,red, green);

从右到左

background: linear-gradient(to left,red, green);

从右上到左下

background: linear-gradient(to left bottom red, green);

从左下到右上

       background: linear-gradient(to  right top   red, green);   

径向渐变:中心点往外散发 可以改变大小 值越大,覆盖的就多

background: radial-gradient ( red 5%, green 30% ,blue 60%);

circle以圆形渐变,div需要宽高值一致,border-radius:50%
background: radial-gradient ( circle , red 5%, green 30% ,blue 60%);

text-shadow文本音像,x抽 y抽 模糊半径 模糊颜色

文字属性: text-overflow:表示超出的本文用什么来表示

在样式框需都写才能生效 overflow:hidden 溢出部分隐藏 text-overflow:ellispsis(省略号) 用省略号来代表被修剪的文本 white-space:nowrap 文本不会换行,在同一行继续。(盒子固定宽度,让文字一行展示,用....表示)

css字体

定义字体:@font-face 给字体起一个名字,针对英文,中文不生效

font-family:myfont

src:url