html – 包装它们之间有间隙的div

html – 包装它们之间有间隙的div,第1张

概述当浏览器窗口变小时,我想要包装到下一行的div.我也希望在div之间放置保证金,以便它们之间存在差距.我遇到的问题是,如果浏览器设置为特定大小,则中心div上的边距会导致div错误地换行.在一定的大小,你有一个div下面的2个div.以下面的截图为例,这个小提琴: http://jsfiddle.net/uhh2jwe2/(改变窗口的宽度) 这确实需要是动态的,因为它将是一个框架解决方案,用于布置 当浏览器窗口变小时,我想要包装到下一行的div.我也希望在div之间放置保证金,以便它们之间存在差距.我遇到的问题是,如果浏览器设置为特定大小,则中心div上的边距会导致div错误地换行.在一定的大小,你有一个div下面的2个div.以下面的截图为例,这个小提琴: http://jsfiddle.net/uhh2jwe2/(改变窗口的宽度)

这确实需要是动态的,因为它将是一个框架解决方案,用于布置不同大小的div.父div将与示例类似.任何帮助都会很棒

#outer {  wIDth: 90%;  height: 90%;  margin: 5%;  overflow: auto;  background-color: red;}.inner1 {  float: left;  wIDth: 150px;  height: 150px;  margin-right: 20px;  background-color: blue;}.inner2 {  float: left;  wIDth: 150px;  height: 150px;  margin-right: 20px;  background-color: blue;}.inner3 {  float: left;  wIDth: 150px;  height: 150px;  background-color: blue;}
<div ID="outer">  <div >1</div>  <div >2</div>  <div >3</div></div>
@H_502_11@解决方法 您可以使用媒体查询来更改较小屏幕上的CSS.
#outer {  wIDth: 90%;  height: 90%;  margin: 5%;  overflow: auto;  background-color: red;}.inner1 {  float: left;  wIDth: 150px;  height: 150px;  margin-right: 20px;  background-color: blue;}.inner2 {  float: left;  wIDth: 150px;  height: 150px;  margin-right: 20px;  background-color: blue;}.inner3 {  float: left;  wIDth: 150px;  height: 150px;  background-color: blue;}@media (max-wIDth: 435px) {  #outer > div {      margin-right:auto;      margin-left:auto;      margin-bottom:15px;      float:none;  }}
<div ID="outer">  <div >1</div>  <div >2</div>  <div >3</div></div>
总结

以上是内存溢出为你收集整理的html – 包装它们之间有间隙的div全部内容,希望文章能够帮你解决html – 包装它们之间有间隙的div所遇到的程序开发问题。

如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。

欢迎分享,转载请注明来源:内存溢出

原文地址: https://outofmemory.cn/web/1134295.html

(0)
打赏 微信扫一扫 微信扫一扫 支付宝扫一扫 支付宝扫一扫
上一篇 2022-05-30
下一篇 2022-05-30

发表评论

登录后才能评论

评论列表(0条)

保存