How to fit children in parent dynamically with flex css [duplicate] - css

This question already has answers here:
Change the number of columns and rows in a grid as the number of items increase
(1 answer)
How to set up a dynamic grid based on flex or grid
(1 answer)
Change grid layout depending on number of elements
(1 answer)
Closed 6 months ago.
I am using react to render images based on the entity's values dynamically. I never know beforehand whether the entity has 1 or 100 images, but i do know if it has 0 <
I am trying to achieve something similar to the example below.
this question is marked as duplicate even though its clearly stating that i am asking for a solution utilizing flex values with dynamic content, not a set number of children with grid...

Related

how to do column stacking using css in wordpress [closed]

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 1 year ago.
Improve this question
i have 2 rows and both rows have 3 columns each having 3 blurbs. what i want to do is that when i make it responsive and lower the resolution at a point these two rows should be converted to 3 rows having two column each instead of having three columns. All using the CSS please
You cannot do this without either a) manipulating the DOM tree with JS dynamically, or b) code up your all your different rows with the correct amount of columns to show for each viewport and then hide and show (swap) these at a certain breakpoint with a media query.
With JS you could avoid duplicating html markup. A pure CSS solution will not be possible without duplicating the markup/content.
For b) your would start with your 2 rows x 3 cols visible and the 3 rows x 2 cols would be hidden with display: none;. Then, as your viewport narrows down you would hide the visible rows with a display: none; for each and reveal the three hidden rows with a display: block; on each of them.

CSS Bootstrap Grid - Wrapping Divs are not starting at the bottom of the Div above it [duplicate]

This question already has answers here:
Is it possible for flex items to align tightly to the items above them?
(5 answers)
Closed 2 years ago.
I'm seeing an issue I've never encountered before. I've searched for the answer, but having a hard time finding the right search terms to find a solution.
I have a row with 3 divs. Using Bootstrap, all three have class="col-md-6"..ie the divs take up 50% width of the row. The content inside them is dynamic, so each div may or may not be in any given view. What I'm trying to achieve is to have them wrap in such a way that if all three have content, two will be on the top "row" and the third below. I have that part working.
The content inside each Div is dynamic, meaning sometimes any given Div may be longer than the other.
So here is what happens:
THIS IS WHAT I WANT TO HAPPEN IN SCENARIO 01 - If Col #1 is longer than Col #2, Col #3 fills in directly below Col #2. This is what I want to happen:
THIS IS NOT WHAT I WANT TO HAPPEN SCENARIO 02 - If Col #1 is shorter than Col #2. Col #3 fills in under Col #1, but it starts where Col #2 ends, leaving a gap.
THIS IS WHAT I WANT TO HAPPEN SCENARIO 02 - I'd like Col #3 to fill directly below Col #1
Any ideas?
Thanks in advance.
Hi and thanks for your question here on Stackoverflow, what you are trying to do is available for Bootstrap. But it can't be achieved by just using the col-md-6 classes.
So Bootstrap has a component for that, something similar is described at the Bootstrap Documentary. It can be found here: https://getbootstrap.com/docs/4.5/components/card/#card-columns
Its called Masonry. This is also achievable via Flexbox and Javascript plugins.
Flexbox: https://w3bits.com/flexbox-masonry/
Javascript Masonry: https://masonry.desandro.com/
Hopefully this does your job.

How to have multiple lines in a treeItem in a treeView in JavaFX?

I was creating like a forum with javaFX. And the question and it's answers are formed using a treeView. Like the question would be a root and it's answers would be it's nodes.
But, it's happening that the treeItems are going straight in only one line, creating a horizontal scroll, and after some words, just putting '...' instead of the rest of the answers. I am using scene builder. Can anyone please tell me a way so that I can eliminate the horizontal scroll, and have the answer in multiple lines?
You have to set the cell's WrapText property, e.g. in the column's cell factory.
Some answers like this one indicate that you have to bind the wrappingWidthProperty to a certain length if you use custom controls inside your cell.

Bootstrap: A gap appears when all elements are not the same height [duplicate]

This question already has answers here:
How to Create Grid/Tile View? [duplicate]
(8 answers)
Closed 7 years ago.
I am using Bootstrap to display a number of items within columns. For the most part these items are the same height so then they are displayed on the page in a series of neat rows. However, when 1 or more of these items are a different height, it leaves a gap between the next item below it.
Please take a look at this example: http://jsbin.com/tedoqe/edit?html,output
How do I reduce the gap between number (3) and number (6)?
I am not going to use a separate row for each row displayed as I want it to be a responsive layout with more items displayed per row on larger displays, and less on smaller displays. (I have left out the relevant classes in the example to clearly display the problem.)
It's perfectly normal behavior. To solve this, please try Masonry or something similar.

breaking ASP.NET long drop down list items into several lines [duplicate]

This question already has answers here:
Closed 10 years ago.
Possible Duplicate:
how to handle long text in dropdownlist control in ASP.NET
I use VS2010, C# to develop ASP.NET web apps, sometimes my drop down contains long items which makes my combos big, is there any way that I can break large items into 2 (or more lines), so that my combo size is fixed?
You can not make it multiline. Instead you can make dropdown control fixed width and its dropdown(items) resize according to the content length
Try using CSS to add a fixed width to your dropdown, like:
select {width: 150px}
Whilst the dropdown itself will be of a fixed width and may not show all of the text, the option elements should expand to the width of the widest element.
Default ComboBox behavior is a little bit too browser dependant. If you want to get an uniform and customized appearance you may use a jQuery plug-in (I assume you're using jQuery). You can start searching from this list.
You can specify a cssClass for the Combo Box and then specify widths/heights for the <li> items.
Look at the different options for a ComboBox here: http://www.asp.net/ajaxlibrary/AjaxControlToolkitSampleSite/ComboBox/ComboBox.aspx

Resources