- 如果要定位那么:
*{
margin: 0;
padding: 0;
}
.hard-box{
width: 100%;
height: 44px;
background: cornflowerblue;
position: fixed; /*这样写它后面还要加上 top 和 left */
top:0;
left: 0;
}
- DIV居中:
margin:0 auto; /*横向居中 */
margin-top: 13px;/*离上面的元素13px 可以调成居中的样子*/
- 如果插入图片尽量这样用
background: url("1.png" ) no-repeat 0 0 ; /* no-repeat 不重复 0 0 是开始的位置如果向下找那么 X,Y都是负数*/
width: 44px;
height: 44px;
display: inline-block;
- 用来处理行内非替换元素的高宽问题的
display: inline-block; /* 把内联标签,变成块级标签*/
来源:CSDN
作者:9Khan
链接:https://blog.csdn.net/weixin_45943458/article/details/103746415