当前位置: 代码迷 >> 综合 >> css 杂项
  详细解决方案

css 杂项

热度:81   发布时间:2024-02-21 22:48:27.0

 

/*css禁止文字被鼠标选中*/
.box {moz-user-select: -moz-none;-moz-user-select: none;-o-user-select:none;-khtml-user-select:none;-webkit-user-select:none;-ms-user-select:none;user-select:none;
}/*文字自动换行(主要针对英文,数字等,中文会自动换行)*/ 
.box{word-wrap:break-word;
}

 实用css布局

水平居中:

1、子框:display:inline-block; 父框:text-align: center;

2、父框:display:flex;子框:margin:0 auto;

3、子框:display:table; + margin: 0 auto;

4、父框:display:flex;justify-content: center;

5、定位

 

垂直居中:

1、父框:display:table-cell;vertical-align: middle;

2、父框:display:flex;align-items: center;

3、定位

 

固比:

1、固:float:left 比:overflow:hidden;

2、固:float:left 比:margin-left:

3、父:display:flex;固:width:xxxpx 比:flex:1;

 

  相关解决方案