[{"createTime":1735734952000,"id":1,"img":"hwy_ms_500_252.jpeg","link":"https://activity.huaweicloud.com/cps.html?fromacct=261f35b6-af54-4511-a2ca-910fa15905d1&utm_source=V1g3MDY4NTY=&utm_medium=cps&utm_campaign=201905","name":"华为云秒杀","status":9,"txt":"华为云38元秒杀","type":1,"updateTime":1735747411000,"userId":3},{"createTime":1736173885000,"id":2,"img":"txy_480_300.png","link":"https://cloud.tencent.com/act/cps/redirect?redirect=1077&cps_key=edb15096bfff75effaaa8c8bb66138bd&from=console","name":"腾讯云秒杀","status":9,"txt":"腾讯云限量秒杀","type":1,"updateTime":1736173885000,"userId":3},{"createTime":1736177492000,"id":3,"img":"aly_251_140.png","link":"https://www.aliyun.com/minisite/goods?userCode=pwp8kmv3","memo":"","name":"阿里云","status":9,"txt":"阿里云2折起","type":1,"updateTime":1736177492000,"userId":3},{"createTime":1735660800000,"id":4,"img":"vultr_560_300.png","link":"https://www.vultr.com/?ref=9603742-8H","name":"Vultr","status":9,"txt":"Vultr送$100","type":1,"updateTime":1735660800000,"userId":3},{"createTime":1735660800000,"id":5,"img":"jdy_663_320.jpg","link":"https://3.cn/2ay1-e5t","name":"京东云","status":9,"txt":"京东云特惠专区","type":1,"updateTime":1735660800000,"userId":3},{"createTime":1735660800000,"id":6,"img":"new_ads.png","link":"https://www.iodraw.com/ads","name":"发布广告","status":9,"txt":"发布广告","type":1,"updateTime":1735660800000,"userId":3},{"createTime":1735660800000,"id":7,"img":"yun_910_50.png","link":"https://activity.huaweicloud.com/discount_area_v5/index.html?fromacct=261f35b6-af54-4511-a2ca-910fa15905d1&utm_source=aXhpYW95YW5nOA===&utm_medium=cps&utm_campaign=201905","name":"底部","status":9,"txt":"高性能云服务器2折起","type":2,"updateTime":1735660800000,"userId":3}]
<>overflow三大作用
<>1、隐藏溢出的内容
例如:
#容器A{ width:50px; } <div id=“A“>你好啊你好啊你好啊你好啊你好啊你好啊你好啊
你好啊你好啊你好啊你好啊你好啊你好啊你好啊你好啊你好啊 你好啊你好啊你好啊你好啊你好啊你好啊你好啊你好啊你好啊</div>
字数过多,宽度较小,装不下自然就会超出容器。
overflow:hidden隐藏超出部分文字
auto 超出后会显示滚动条
scroll 永远有滚动条
<>2、解决外边距塌陷
在一个父元素中,子元素设置margin-top/bottom会塌陷给父元素,为防止这种现象发生,解决办法有:
设置父元素的padding、border、overflow:hidden。
<>3、解决浮动导致的父元素高度塌陷问题
父元素高度没有设置的情况下,子元素全部浮动,就会导致父元素高度塌陷。解决办法之一就是给父元素设置overflow。详情见下面代码。
overflow:hidden、auto、scroll均可。推荐使用hidden。这样父元素就会根据子元素或者子元素内容自适应变化。
.list1 { background: green; width: 800px; /* 6-内容溢出 */ /* 溢出隐藏 */ /* overflow:
hidden; */ /* 设置了之后,没有设置高度的父元素就会随着 */ /* 溢出自适应,出现滚动条 */ /* overflow: auto; */
/* 溢出必出现滚动条 */ /* overflow: scroll; */ /* 溢出显示,不能清除浮动 */ /* overflow: visible;
*/ }