Take a look at this image:
As you can see the 2 end links break out of the anchor container.
This is only happening on an iPad (using simulator to test).
On the desktop it behaves as it should by breaking the words in the other links allowing for more space to distribute the remaining items.
It's as if ios doesn't know how to properly break the text in the first link.
.nav-section {
padding: 0 30px;
}
.nav-section__list {
display: inline-flex;
align-items: stretch;
margin: 0 auto;
}
.nav-section__item {
padding: 0 20px;
}
.nav-section__link {
display: block;
background: red;
}
<nav class="nav-section">
<div class="nav-section__list">
<div class="nav-section__item">
<a href="#" class="nav-section__link">AAAAA AAAA-AAAAAAAA AAAAAAAAA</a>
</div>
<div class="nav-section__item">
<a href="#" class="nav-section__link">AAA AAAAAAAA AAAAAAAAAA</a>
</div>
<div class="nav-section__item">
<a href="#" class="nav-section__link">AAAAAAAAAAA</a>
</div>
<div class="nav-section__item">
<a href="#" class="nav-section__link">AAAAAAA</a>
</div>
</div>
</nav>
Update
word-break: break-all
is not a valid solution:word-wrap: break-all
also doesn't work:This is the same resolution but on a desktop:
As you can see the way the words break is completely different. The iPad just doesn't want to co-operate.
Update 2
I have run into the same issue in another instance of flexbox. It seems like IOS still has some bugs with the implementation.
So I went ahead and used display: table;
and display: table-cell;
just until the issue is resolved.
If anybody has any other hints as to exactly why the issue might be happening that would be great. Thanks!
The justify-content property applies only to a flex container. In your code, justify-content is applied to the items, so it's having no effect. Re-assign it to the container. Of course, an element can be both a flex container and item, in which case all properties apply.
To set space between the flexbox you can use the flexbox property justify-content you can also visit all the property in that link. We can use the justify-content property of a flex container to set space between the flexbox.
For 3 items per row, add on the flex items: flex-basis: 33.333333% You can also use the flex 's shorthand like the following: flex: 0 0 33.333333% => which also means flex-basis: 33.333333% .
Flexbox is relatively new, and browsers may have implemented it a little diferently from each other.
You may be missing the -webkit-
prefix, as it looks like safari did need it on some versions.
display: -webkit-inline-flex;
display: inline-flex;
-webkit-align-items: stretch;
align-items: stretch;
Or, maybe you could try using:
word-break: break-all;
To ensure that those words will be broken, and will not overflow.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With