M
M
mletov2018-04-16 15:04:20
css
mletov, 2018-04-16 15:04:20

How to set the number of items in a row?

Please tell me
there is a div, width in %. In it, the descendants go in a grid.
How can I specify how many descendants can be in one row (the number flies into the input script).
The width of descendants cannot be set, including in %.
I want something like

<style>
.parent
{
     max-count-item-in-row: 10;
}
</style>
<div class="parent">
    <div class="item"></div>
    <div class="item"></div>
    <div class="item"></div>
    <div class="item"></div>
    <div class="item"></div>
   <div class="item"></div>
   <div class="item"></div>
....
</div>

Now I count the width of the item through js as a percentage, but something is somehow a crutch. I want a beautiful solution in html + CSS

Answer the question

In order to leave comments, you need to log in

1 answer(s)
J
Jumandjilos, 2018-04-16
@mletov

study css grid, through it you can easily set up a grid, and there you can specify how many elements to put in a row or column. I’ll even give you a link, everything is well explained here https://www.youtube.com/watch?v=-fDqBEjfzGo

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question