I have a main container with an aside. The aside has a fixed width, and I am using CSS Grid to draw this container. Inside the main container, there is a series of columns with dynamic data that automatically flow and align and shift data from one column to the other as needed. This column setup uses CSS Multi Columns, but the columns change width based on the user browser screen size. I would like to find a CSS solution that keeps these columns to a set width. Is there a way to auto expand the last drawn column? OR Is there a way to keep a dynamic multi-column count from expanding? I tried align-items:start
, but don't see an effect. Could there be a way through a container to keep the columns to their set width?
@charset "UTF-8";
/* https://stackoverflow.com/questions/7785374/how-to-prevent-column-break-within-an-element */
html, body {
padding: 0;
margin: 0;
}
section {
padding: 3px;
}
input {
width: 100%;
box-sizing: border-box;
}
label {
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
display: block;
font-family: "Miriam Libre";
font-size: 10px;
color: #213C3A;
}
.Cols {
margin: 0;
padding: 0;
columns: 40ch;
column-count: auto;
column-fill: auto;
column-rule: 1px dotted #3DB199;
height: 100vh;
/* ↓ columns defined by width */
overflow: auto;
}
li {
width: 100%;
display: inline-block;
padding: 3px;
border-bottom: 1px solid #D36B66;
}
.G {
display: grid;
}
.G-wAside {
grid-template-columns: 1fr minmax(0, 10vw) 10vw;
gap: 1vw;
}
.G-23 {
grid-template-columns: 66.66% 33.33%;
}
.HVpZ {
height: 100%;
}
.WVpZ {
width: 100%;
}
.filler {
background: #CCE0E2;
}
.fieldset {
margin: 5px 3px;
}
.fieldset > * {
margin: 1px 0;
}
.fieldset label {
margin-right: 3px;
}
.placeholder-uploader {
height: 320px;
width: 100%;
background: #FAF9E9;
}
.placeholder-grid {
width: 640px;
height: 230px;
background: #FAF9E9;
position: absolute;
}
.col-container {
overflow: hidden;
position: relative;
height: 100px;
grid-row-start: span 2;
}
<main class="G HVpZ WVpZ G-wAside">
<section>
<ul class="Cols">
<li>
<div class="fieldset">
<label>New List Is Just Long</label>
<input type="text"></input>
</div>
<div class="fieldset">
<label>Label Is Just Long</label>
<input type="text"></input>
</div>
<div class="fieldset">
<label>Label Is Just Long</label>
<input type="text"></input>
</div>
<div class="fieldset">
<label>Label Is Just Long</label>
<input type="text"></input>
</div>
<div class="col-container">
<div class="placeholder-grid"></div>
</div>
<div class="G G-23">
<div class="fieldset">
<label>Grid Label DIV Name</label>
<input type="text"></input>
</div>
<div class="fieldset">
<label>Label Is Just Longest Of All</label>
<input type="text"></input>
</div>
</div>
<div class="fieldset">
<label>Label Is Just Long</label>
<input type="text"></input>
</div>
</li>
<li>
<div class="col-container">
<div class="placeholder-grid"></div>
</div>
</li>
<li>
<p>Praesent vestibulum semper erat ut varius. Donec sed erat ac odio ultricies bibendum et sit amet lectus. In placerat consequat mi, sed commodo mauris ornare non. Integer nibh leo, dignissim in purus at, pretium porta nibh. Nulla vestibulum imperdiet
sollicitudin. Morbi euismod justo metus, quis imperdiet nunc eleifend ultrices. Donec nec maximus lacus. Aenean tincidunt mattis nisi, eget molestie dolor iaculis vel. Praesent faucibus risus vel arcu tincidunt, id varius orci bibendum. Duis
posuere est in diam luctus ultrices id in sapien. Fusce bibendum pharetra velit, sit amet commodo diam pharetra ac.</p>
</li>
</ul>
</section>
<section class="filler">← How to auto-fill this space to keep css multi columns in previous grid item to set width of 40ch? →</section>
<section class="bg">Aside</section>
</main>