# 前端CSS学习 **Repository Path**: hongxiaohan/front_end_css_learning ## Basic Information - **Project Name**: 前端CSS学习 - **Description**: 前端CSS的学习 - **Primary Language**: CSS - **License**: MulanPSL-1.0 - **Default Branch**: master - **Homepage**: None - **GVP Project**: No ## Statistics - **Stars**: 0 - **Forks**: 0 - **Created**: 2020-07-20 - **Last Updated**: 2023-04-20 ## Categories & Tags **Categories**: Uncategorized **Tags**: None ## README ### CSS小技巧 #### 1、去除input 输入框锁定的轮廓颜色 关键字 outline: none; #### 2 、禁止改变textarea大小 关键字 resize: none; #### 3、图片和文字对齐以及图片底部空白BUG 关键字vertical-align: middle; #### 4、单行省略号隐藏 overflow: hidden;text-overflow: ellipsis;white-space: nowrap; #### 5、多行省略号隐藏(兼容性差) overflow: hidden;display: -webkit-box;-webkit-line-clamp: 3;-webkit-box-orient: vertical; #### 6、京东初始化代码CSSS ```css /* 把我们所有标签的内外边距清零 */ * { margin: 0; padding: 0 } /* em 和 i 斜体的文字不倾斜 */ em, i { font-style: normal } /* 去掉li 的小圆点 */ li { list-style: none } img { /* border 0 照顾低版本浏览器 如果 图片外面包含了链接会有边框的问题 */ border: 0; /* 取消图片底侧有空白缝隙的问题 */ vertical-align: middle } button { /* 当我们鼠标经过button 按钮的时候,鼠标变成小手 */ cursor: pointer } a { color: #666; text-decoration: none } a:hover { color: #c81623 } button, input { /* "\5B8B\4F53" 就是宋体的意思 这样浏览器兼容性比较好 */ font-family: Microsoft YaHei, Heiti SC, tahoma, arial, Hiragino Sans GB, "\5B8B\4F53", sans-serif } body { /* CSS3 抗锯齿形 让文字显示的更加清晰 */ -webkit-font-smoothing: antialiased; background-color: #fff; font: 12px/1.5 Microsoft YaHei, Heiti SC, tahoma, arial, Hiragino Sans GB, "\5B8B\4F53", sans-serif; color: #666 } .hide, .none { display: none } /* 清除浮动 */ .clearfix:after { visibility: hidden; clear: both; display: block; content: "."; height: 0 } .clearfix { *zoom: 1 } ``` 文字渐变色技巧 ```css 只能是span标签 span { background: linear-gradient(to right, red, blue); -webkit-background-clip: text; color: transparent; } ```