简体   繁体   English

w3-CSS append 当内容宽度大于带有 inline-flex 的 div 中的视口宽度时换行

[英]w3-CSS append newline when content width greater than viewport width in div with inline-flex

I'm appending a bunch of boxes with w3-card into this div:我将一堆带有 w3-card 的盒子附加到这个 div 中:

<div id="myClasses" class="w3-container" style="display: inline-flex;">

Here's where I append it:这是我 append 的位置:

myclasses.append([
     $('<div/>', {"class": "w3-card button", "onclick": "enterThisClass(" + e + ")"}).append([
           $('<h3/>').text(snapshot.val().name)
     ])
])

This works ok, but when I have too many boxes side by side, they just squish together and hide the ones over the edge.这工作正常,但是当我并排放置太多盒子时,它们只会挤压在一起并将它们隐藏在边缘上。 How would I make it so it wouldn't squish nor go over the edge, but rather make a new line?我将如何做到这一点,这样它就不会压扁 go 边缘,而是换一条线?

try adding width to the dynamic div.尝试向动态 div 添加宽度。 Like 20%.比如 20%。 So when you append 5 div's.所以当你 append 5 div 的时候。 The 6th div will auto shift below.第 6 个 div 将在下方自动移动。 Try尝试

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 CSS-使内容的div宽度(inline-flex div) - CSS - Make div width of content (inline-flex divs) 当元素的宽度大于视口的宽度时… - When width of an element is greater than the width of a viewport… CSS:带有 inline-flex 的“width: auto”容器的行为规则是什么? - CSS: What are the behavior rules for a "width: auto" container with inline-flex? 将inline-flex元素调整为屏幕宽度 - Adjust inline-flex elements to the screen width 有没有办法拉伸包裹在 inline-flex 中的块以匹配父 div 宽度? - Is there anyway to stretch a block wrapped in an inline-flex to match parent div width? div宽度大于100%,并将溢出的部分隐藏在视口之外 - div width greater than 100% and hide overflowing part out of the viewport 当其他div中的内容宽度大于100%时,div不显示100%宽度 - div doesn't display 100% width when the content width in other div is greater than 100% 当文本超过一行时,内联 - 柔性div被推下 - Inline-flex div gets pushed down when text is more than one line 如何包装 inline-flex div 内容,使包装部分占据前一个 inline-flex div 下面的空白空间? - How to wrap inline-flex div content such that the wrapped portion occupies empty space below the previous inline-flex div? 内联flex容器(display:inline-flex)正在扩展父容器的整个宽度 - Inline flex container (display: inline-flex) is expanding the full width of parent container
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM