🔥码云GVP开源项目 12k star Uniapp+ElementUI 功能强大 支持多语言、二开方便! 广告
1. 可以不设置width时尽量不设置width,保留内容的流动性 2. 对于内联元素,最小宽度为当文字为汉字时则为一个汉字的宽度。当为英文时,则为一个没有空格的英文的宽度,比如: ~~~ .father { width: 0; } <div class='father'> <span>子元素</span> </div> ~~~ 他的效果图是这样的 ![](https://box.kancloud.cn/39651efdd3fcdb198af206ac638e2226_51x88.png) 他的子元素并不会被隐藏 3. inline-block元素,他的意思是他的外部盒子使用的是inline 4. line-height 无法影响替换元素,即img等标签使用line-height时无法让其垂直居中的 5. line-height:1.5和line-height:150%;的区别在于,当为1.5时,子元素继承的是他的属性值,当为150%时,子元素继承的是他的计算最终值。 ### after伪元素 1. after伪元素要生效需要3要素 - display:block;table; - content: '' - width;and height;