Flow Multi-Column Elements Left-Right Before Top-Down

Flow multi-column elements left-right before top-down

Like this?

<style>
ul {list-style: none;}
li {float: left;}
li:nth-child(2n+1) {clear: left;} /* 1st of every twos */
</style>
<ul>
<li>item 1</li>
<li>item 2</li>
<li>item 3</li>
<li>item 4</li>
</ul>

How to flow multi-column elements from left to right before top-down in css?

Simple option would be to use flex with flex-wrap:

.list-tomorrow-page {  display:flex;   flex-wrap:wrap;}
.article-tomorrow-page { width:50%;}
<ul class="list-tomorrow-page">   <li class="article-tomorrow-page">1</li>   <li class="article-tomorrow-page">2</li>   <li class="article-tomorrow-page">3</li>   <li class="article-tomorrow-page">4</li>   <li class="article-tomorrow-page">5</li>   <li class="article-tomorrow-page">6</li>   <li class="article-tomorrow-page">7</li></ul>

CSS columns with left-right flow

The multi-column specification offers no property to change the distribution of elements among the columns: http://www.w3.org/TR/css3-multicol/. Such a property seems to go against what the module was designed for (recreating how newspaper or magazine articles are laid out).

None of the other pure CSS solutions will allow you to achieve the effect you are looking for.

CSS multi-column layout of list items doesn't align properly in Chrome

You need each item in the column to be displayed as "inline-block". That will solve your problem without needing to use jQuery.

Additionally, each element can be specified to have width: 100% in order to get the them to use the full width of the rows.

Here is a working example:

$(document).ready(function() {    for( var i = 0; i < 24; i++ ) {        $("ul.newslist").append("<li><a href='#'>Item</a></li>");    }    $("ul.newslist > li").click(function() {        $(this).remove();    })});
ul.newslist {    columns: 5;    background-color: #ccc;    padding: 16px 0;    list-style: none;}
ul.newslist > li { display: inline-block; width: 100%; border-top: 1px solid #000;}
ul.newslist > li > a { display: block; padding: 4px; background-color: #f6b; text-decoration: none; color: inherit;}
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script><ul class="newslist"></ul>

UL/LI which flows down, then to the right when it runs out of room

What you're looking to do, you can't do with pure CSS, unfortunately. You can with a combination of javascript and CSS.

Flutter align two items on extremes - one on the left and one on the right

Use a single Row instead, with mainAxisAlignment: MainAxisAlignment.spaceBetween.

new Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
new Text("left"),
new Text("right")
]
);

Or you can use Expanded

new Row(
children: [
new Text("left"),
new Expanded(
child: settingsRow,
),
],
);


Related Topics



Leave a reply



Submit