布局技巧
小旋风01234
嘤嘤嘤
展开
-
图片大于父盒子,怎么居中,超出隐藏
图片大于父盒子,怎么居中,超出隐藏 布局技巧: .box { height: 375px; height: 375px; overflow: hidden; position: relative; width: 100%; img { position: absolute; height: 375px; left: 50%; transform: translate(-50%, 0); } } ...原创 2020-08-13 22:33:13 · 840 阅读 · 0 评论 -
清除浮动(最快和兼容性最好的方法)
1. 父亲溢出隐藏 overflow:outo 说明: 使用:父亲加overflow:outo就行了 优点:简单,代码少,浏览器支持好 缺点: 内部宽高超过父级div时,会出现滚动条 2. 父级定义伪元素:after .clearfix:after{ content:"";//设置内容为空 height:0;//高度为0 line-height:0;//行高为0 display:block;//将文本转为块级元素 visibility:hidde原创 2020-07-14 10:11:45 · 168 阅读 · 0 评论