简体   繁体   English

使用CSS或HTML或JavaScript对列表进行内容包装?

[英]Content wrapping for lists using CSS or HTML or JavaScript?

I am curious how I would get content to wrap around the elements like at the link below. 我很好奇如何获得内容来包裹元素,例如下面的链接。 The flex-wrap feature does get them to wrap around somewhat but it leaves a lot of white space as demonstrated in the second link. flex-wrap功能确实使它们有些缠绕,但是如第二个链接中所示,它留下了很多空白。

http://saijogeorge.com/website-builders/ http://saijogeorge.com/website-builders/

My source code and demo here 我的源代码和演示在这里

Unfortunately this doesn't seem to possible to solve with just CSS. 不幸的是,这似乎不可能仅用CSS就能解决。 Saijo George solves the problem by using inline absolute positioning, controlled through JavaScript. Saijo George通过使用内联绝对定位(通过JavaScript控制)解决了该问题。

For example, #bot-builders has a default inline style of: position: absolute; top: 130px; left: 400px; 例如, #bot-builders的默认内联样式为: position: absolute; top: 130px; left: 400px; position: absolute; top: 130px; left: 400px; . These variables change whenever the browser is resized. 每次调整浏览器大小时,这些变量都会更改。

Adding the above to your example solves the problem, though naturally messes up the display at different widths. 将以上内容添加到您的示例中可以解决此问题,尽管自然会弄乱不同宽度的显示。 You could create a bunch of media queries to change every single list's values at multiple widths, though that would seem a bit overkill. 您可以创建一堆媒体查询来以多种宽度更改每个列表的值,尽管这似乎有些过头。 Ultimately, you may need to contact Saijo George to find out exactly what JavaScript they are using to control the responsiveness. 最终,您可能需要联系Saijo George,以准确了解他们使用什么JavaScript来控制响应性。

Hope this helps! 希望这可以帮助!

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

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM