web全栈 (2019.10.26-10.27) 一、css样式 1.颜色设置方式(以红色为例) ①color:red; ②color:#ff0000; ③color:rgb(255,0,0); /带透明度的色彩值,例中透明为0.5/ color:rgba(255,0,0,.5); 或 color:rgb(255,0,0); opacity:50%; /透明度为原来的50%/ 2.设置圆角 border-radius:值 值:a 表示四角都为相同的圆角状态 值:a b 表示 左上,右下都为a,右上,左下都为b 值:a b c 表示左上为a 右上和左下为b 右下为c 值:a b c d 依次表示 左上 右上 右下 左下 值:50% 表示圆或椭圆
二、css布局及定位 1.定位 position:属性;(相对于谁定位) relative 相对定位 (相对于其直接父元素定位) absolute 绝对定位 (以最近定位元素为参考点进行定位) fixed 固定定位 (相对于浏览器窗口定位) 以上定位与left,right,top,bottom,z-index等属性联合使用起到定位作用。 特别的: 定位中水平居中方法: position: absolute; right:0; left:0; margin:auto; 2.布局(盒子模型) 宽:内容宽+border+margin+padding 特别的:通过 box-sizing: border-box; 设置: 宽:width+margin (width=内容宽+border+padding)
三、其他
overflow:hidden; 溢出隐藏:first-of-type 第一个同类型对象:nth-of-type(n) 第n个同类型对象 n=数字 odd(奇数行) even(偶数行)input{ outline:none; } 去外边框线cursor: pointer; 鼠标图标成手状