1.控制单行文本与多行文本超出显示…
单行文本:
overflow:hidden;text-overflow:ellipsis;white-space:nowrap;
多行文本:
overflow: hidden;display: -webkit-box;-webkit-box-orient: vertical;-webkit-line-clamp: 2;
2.禁止文本选择
<p>你可以选择我。</p><p class="unselectable">你不能选择我!</p>.unselectable {user-select: none;}
3.计数器(ul,li的嵌套)

<ul><li>List item</li><li>List item</li><li>List item<ul><li>List item</li><li>List item</li><li>List item</li></ul></li></ul>ul {counter-reset: counter;}li::before {counter-increment: counter;content: counters(counter, '.') ' ';}
4.当标签没有默认样式时,为其设置默认样式
//当a标签没有class类时,设置下面的样式a[href]:not([class]){color: #4f4f34;text-decoration: underline;}
5.使用min-height设置如浏览器右边内容较多时的滑块样式
.slider{max-height: 200px;overflow-y : hidden;width: 300px;}.slider:hover{max-height: 600px;overflow-y: scroll;}
6.迟钝的猫头鹰选择器
//*+*{margin-top:10px;}
7.点击事件,点击元素时的交互行为(元素变灰并且不能再次点击了)。
.button-disabled{opacity: .5;pointer-events: none;}
pointer-events:auto| none | visiblepainted | visiblefill | visiblestroke | visible | painted | fill | stroke | all
其中none值能阻止点击、状态变化和鼠标指针变化,意思是元素永远不会成为鼠标事件的target。但是,当其后代元素的pointer-events属性指定其他值时,鼠标事件可以指向后代元素,在这种情况下,鼠标事件将在捕获或冒泡阶触发父元素的事件侦听器。
除了auto和none,其他值只能应用在SVG上
兼容性:红色不兼容,绿色兼容
8.使用:not排除法
大多写法:
/ *添加边框* /.nav li {border-right: 1 px solid #666 ;}/ *删除边框* /.nav li :last-child {border-right: none ;}
简单写法:
.nav li :not(:last-child){border-right:1 px solid #666 ;}
9.添加line-height到body,文本元素继承
body{line-height:1.5}
