S
S
sanns2015-10-06 10:28:15
css
sanns, 2015-10-06 10:28:15

Why does the last inline-block wrap even though there is enough space for it not to wrap?

There is a code: codepen.io/sanns/pen/WQjRoj?editors=110)
I tried to make the menu itself on the right, and the elements to be moved along the left edge. I did so, but for some reason the last element is transferred, although there is enough space for it at high resolutions. Tell me, please, what's the matter? Thank you!

Answer the question

In order to leave comments, you need to log in

5 answer(s)
S
sanns, 2015-10-06
@sanns

suggested on stackoverflow not to set margins as a percentage
codepen.io/sanns/pen/WQjRmM?editors=110

D
Dmitry Novikov, 2015-10-06
@dmitriy_novikov

do this:

.navg {
    display: block;
    text-align: right;
}

S
Sasha, 2015-10-06
@userAlexander

Each browser adds padding to inline-block elements by default, the size of this padding varies depending on the browser.
To avoid this, the closing and opening tag of the element is left on the same horizontal tag, which is styled as an inline block (without a space).

<div class="inline-block-elem">
  text
</div><div class="inline-block-elem">
  text
</div>

A
Alex K, 2015-10-06
@alexk111

Remove styles from .navg and everything will work. Here:
codepen.io/anon/pen/vNmgQG

A
Alexander Gamov, 2015-10-06
@slowdream

Strange, I started formatting your html and the block aligned as it should, it feels like there are non-portable spaces (although they should have been visible in the editor)

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question