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.
Related
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...
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.
Closed. This question needs debugging details. It is not currently accepting answers.
Edit the question to include desired behavior, a specific problem or error, and the shortest code necessary to reproduce the problem. This will help others answer the question.
Closed 7 years ago.
Improve this question
I used kartik gridview plugin and I have a gridview with a lot of columns so it generated a horizontal scroll bar. But the page generates 2 scroll bars. One for the gridview and one for the page. How to eliminate the body scroll? and how to make the gridview horizontal scroll sticks so that the user will no longer need to scroll to the bottom in order to see the horizontal scroll?
For the body scroll simply try adding in your index view
<style type="text/css" media="screen">
body {
overflow-x: hidden;
}
</style>
For the second question could be useful reduce (in pagination ) the number of lines displayed
eg: this way
public function actionIndex()
{
$searchModel = new YourModelSearch();
$dataProvider = $searchModel->search(Yii::$app->request->queryParams);
$dataProvider->pagination->pageSize=5;
...........
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.
Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 7 years ago.
Improve this question
Is there a simpler way to even distribute multiple objects within the bounds of another object?
I've included a picture to help illustrate what I want done.
The green portion is my artboard, the gray portion is the main body and I would like item1-6 to be even distributed within the bounds of the white box. Typically to achieve the desired result I have to create additional objects (represented by the red lines) and place one at the left end of my box, one at the right end, and one between each item, and then use the distribute evenly button and remove the red lines afterwards.
I imagine there is a faster way but I can't seem to find it. Any ideas are appreciated.
Okay, this is slightly fiddly, but hopefully this will seem quite inuitive once you've done it once or twice.
Short version;
Find the width of your container.
Select container and objects - then set container to Key Object.
Enter width of container into Align window: Distribute Spacing, divide the figure by the number of objects, then click Horizontal Distribute Center.
Group your objects and center them to your container. Ungroup them again, if desired.
Long version;
1. Work out the width of your containing box (or artboard, if you are distributing your items to that). If, for example, you have a rectangle you can simply select it and look at the 'W' (width) value at the top of the window (click on Transform to reveal the info if you're working on a smaller screen). Just remember this number - nothing else.
2. Select all of your items AND your container. Click on the container again to make it the 'Key Object' (you should see that its selection edge becomes distinctly fatter).
3. If necessary, open up your ALIGN window (Window > Align). With the window visible, you should see three rows or sections from which to choose - 'Align Objects', 'Distribute Objects' and 'Distribute Spacing'. If the latter is missing, you may need to click on the little up/down arrow symbol next to the 'Align' tab title a few times in order to expand all of the options.
4. Ensuring that you still have all of your items selected and your container set as the Key Object (The 'Align To' box should automatically be set to 'Align to Key Object' in recognition of this), enter the container width you took note of earlier into the 'Distribute Spacing' box - and append /x where x = the number of items you have. So, if your box is 200 pts wide, and you have 5 items, you would enter 200/5 - this will just save you having to do the maths. Illustrator will automatically divide your starting figure and (in the case of this example), it would change to 40 pt (200 divided by 5).
5. Now click on the Horizontal Distribute Center button and all of your items will be set to the correct spacing. They probably WON'T be properly aligned with your container, though, so ...
6. In order to prevent your nicely spaced items being messed up by the next step, DE-SELECT the container (so only your items are selected), group them together - either with the keyboard shortcut CTRL+G (or COMMAND+G on Mac), or by going to Object > Group.
7. With the items grouped, re-select your container (so container AND group of objects are selected), make the container the Key Object again - if you don't want to see it move) and click on Horizontal Align Center. Your items will now be properly centered in your container and can be safely ungrouped if you wish (Ctrl+Shift+G / Command+Shift+G).