老师,为什么 position 这块用这么多 定位 去做呢?
来源:8-6 使用Scss 组织地址区域布局

All_Good
2021-04-29
上面老师的code;
下面学生的:
.wrapper {
&_position {
display: flex;
justify-content: center;
padding: 0.16rem 0;
width: 100%;
height: 0.22rem;
line-height: 0.22rem;
font-size: 0.16rem;
color: #333;
&_detail {
margin: 0 0.463rem 0 0.085rem;
width: 2.5rem;
@include ellipsis;
}
.wrapper_position_location {
width: 0.154rem;
height: 0.19rem;
}
.wrapper_position_notice {
width: 0.183rem;
height: 0.192rem;
}
}
}
北京理工大学国防科技园2号楼10层
- 刚才打了一堆话,不见了。。。
- 老师,为什么在布局的时候,老师用这么多定位呢?如果 left center right 直接给固定宽,这样是不是在实际项目中不太好?
.wrapper {
overflow-y: auto;
position: absolute;
left: 0;
top: 0;
bottom: .5rem;
right: 0;
padding: 0 .18rem .1rem .18rem;
}
- 这一块为什么要用定位呢?从上往下布局是不是不好呢?学生实战经验少,望指点迷津。
写回答
1回答
-
你可以不用定位,但是会有比较多的坑,我建议同学,你按你的思路先写,写完遇到问题,你自然明白为什么要用定位了。实际上如果你flex 玩的好,也可以用flex解决这块的问题的。
012021-05-04
相似问题