G
G
Grigory Vasilkov2016-02-10 18:40:26
css
Grigory Vasilkov, 2016-02-10 18:40:26

How to make margin-bottom on all inline-blocks that are "not on the last line"?

Inline blocks are automatically wrapped to a new line.
It's good when one inline block occupies the entire line and you can put :not(:last-child).
But what if there are a lot of inline blocks, and we do not know in advance how many of them will move to the last line?
That is, the line size is of course limited. That is, for example, they will fit 3 pieces per line. But the last line can contain either 1 or 2 or 3 elements.
And you need to make sure that the last line does not have margin-bottom: 10px, and all the rest do.
How to do it smart?

Answer the question

In order to leave comments, you need to log in

2 answer(s)
S
Sergey delphinpro, 2016-02-10
@gzhegow

https://jsfiddle.net/8zcu2mqz/

O
Olga Grabko, 2016-02-12
@MyaFF

Take a look at CSS Quantitative Selectors
. For your particular question, you have already been given a good and simple solution, but the article describes solutions for many similar and more complicated situations.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question