CSS常用样式

1、background

  • CSS的background属性的缩写顺序
    • background-color;
    • background-image;
    • background-repeat;
    • background-attachment;
    • background-position;
    • background-size。
  1. background: #ff0000 url(/i/eg_bg_03.gif) no-repeat fixed center/100% 100%;
  2. background: blue url("./img/aratar.png") no-repeat fixed center/cover;

2、img

img在不必要的情况下,不需要positon到div.img去,否则比较容易出现一些奇怪的问题。

//[img图片在div里边高度不能自动撑满解决办法](https://blog.csdn.net/qq_38543537/article/details/81560698)
//使用display:block;

3、样式重置

1). Scroll重置

4、单行或多行溢出

CSS实现单行、多行文本溢出显示省略号(…) ,下面两种方式仅仅适用于-webklt浏览器和移动端,更多注意详情见链接内的详情介绍。

  • 单行溢出:
overflow: hidden;
text-overflow:ellipsis;
white-space: nowrap;
  • 多行溢出:
    display: -webkit-box;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 3;
    overflow: hidden;
    

5、Flex模块

flex占据剩余位置
https://www.cnblogs.com/wuyou91/p/9129344.html

6、字符分散对齐