P
P
Pavel_Proca2017-01-06 16:46:03
css
Pavel_Proca, 2017-01-06 16:46:03

Is it possible to style the block that is the last one in the line?

For example, there is a block, and it has several elements in a row. A certain margin is set between these elements on the right. When the screen is reduced, these elements one by one go to the next line. The last element, of course, should not have a margin. How to make it so that after the transition of the element to the next line, the margin was removed from the element that remained in the previous line last in place of the one that moved.
Here you can see a more specific example of what I'm trying to do.

Answer the question

In order to leave comments, you need to log in

3 answer(s)
A
Ankhena, 2017-01-06
@Pavel_Proca

Calculate.
Either JS.
Or count in your mind and set media and nth-child

A
Andrey Verkh, 2017-01-06
@sadisme

Give the wrapper a negative right margin to compensate for the padding.

A
aarty20, 2017-01-06
@aarty20

I would advise you to go from the opposite - set not the right, but the left margin for all elements, and remove it altogether for the first element (: first-of-type).

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question