Search code examples
csstwitter-bootstrapsafari

Third element ends up in new line in Safari


I have a simple Bootstrap layout:

<div class="row">
    <div class="footer_column col-md-4">
        <div class="footer_item">
            ABOUT
        </div>
        <div class="footer_item">
            <a href="{{ route('contact') }}">Contact Us</a>
        </div>
        <div class="footer_item">
            <a href="{{ route('terms') }}">Terms & Conditions</a>
        </div>
        <div class="footer_item">
            <a href="{{ route('privacy') }}">Privacy Policy</a>
        </div>
    </div>
    <div class="footer_column col-md-4">
        <div class="footer_item">
            SITE RESOURCES
        </div>
        <div class="footer_item">
            <a href="{{ route('rules') }}">General Rules</a>
        </div>
        <div class="footer_item">
            <a href="{{ route('rules') . '#scoring' }}">Scoring</a>
        </div>
        <div class="footer_item">
            <a href="{{ route('rules') . '#coins' }}">Game Coins</a>
        </div>
        <div class="footer_item">
            <a class="store-show">Store</a>
        </div>
        <div class="footer_item">
            <a href="{{ route('account.choose') }}">Account Types</a>
        </div>
    </div>
    <div class="footer_column col-md-4">
        <div class="footer_item">
            MORE FANTASY FOOTBALL
        </div>
        <div class="footer_item">
            <div class="footer_item">
                <a href="www.example.com">Fantasy Game</a>
            </div>
        </div>
    </div>
</div>

In Chrome and Firefox it looks like it's supposed to (a 3 column layout):

enter image description here

But in Safari the 3rd column ends up in a new line below the other. When I inspect it, it has the correct width (exactly 1/3 of the total row width) in both Chrome and Safari.

I am seeing this when I inspect the element:

.col-md-4 {
    flex: 0 0 33.3333333333%;
    max-width: 33.3333333333%;
}

When I remove the max-width attribute, each column spreads out to 100%. This is expected I suppose. But when I add width: 20% for example, the width of each column remains the same as it was!

How can I make Safari behave?


Solution

  • If you're using a container around the row then add a helper class to remove the before content.

     <div class="container before-fix"><!-- content --></div>
    
     .before-fix::before {
       content: none;
     }