Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

CSS Grid not working in Safari

Tags:

css

safari

I'm trying to figure out if there is something wrong that I'm doing or is CSS grid not supported in Safari (MacOS or iOS) even though everywhere they say it's supported?

I tried something like this:

  ul {
      list-style-type: none;
      text-align: center;
  }
  .grid {
        display: grid;
        grid-gap: 20px;
    }
    .grid-4 {
 	   grid-template-columns: repeat(4, auto);
	}
    <ul class="grid grid-4">
        <li class="grid-item">
            <img src="http://via.placeholder.com/350x150"/>
            <a href="/">Browse Online, Buy in Store</a>
        </li>
        <li class="grid-item">
            <img src="http://via.placeholder.com/350x150"/>
            <a href="/">Browse Online, Buy in Store</a>
        </li>
        <li class="grid-item">
            <img src="http://via.placeholder.com/350x150"/>
            <a href="/">Browse Online, Buy in Store</a>
        </li>
        <li class="grid-item">
            <img src="http://via.placeholder.com/350x150"/>
            <a href="/">Browse Online, Buy in Store</a>
        </li>
    </ul>

It works fine in Chrome, FF and even on latest Edge, but not on Safari 10.0.1

like image 500
AdrianS Avatar asked Jul 04 '18 19:07

AdrianS


People also ask

Does Safari support CSS grid?

The supporting browsers Other than in Internet Explorer, CSS Grid Layout is unprefixed in Safari, Chrome, Opera, Firefox and Edge.

Is CSS grid all browsers compatible?

Most developers are afraid to start using CSS Grid because of browser support, but CSS grid is fully supported in all main browsers: Chrome, Firefox, Safari, Edge including their mobile versions.

How do I turn on grid in CSS?

You can turn on the grid button located in the div which has display: grid declared. All you have to do is go to your browser's developer tools (mine is Microsoft Edge which is based on Chromium). You will see a button like this. And then you can code and test as you wish.

How do I reset my CSS grid?

The most simple way to reset any CSS property to its initial value is to use initial value. It will work on any property and you won't have to worry about any property defaults. But in the current case 1fr and none will work as well, of course.


1 Answers

CSS Grid is only supported as of Safari 11.1 on Desktop and Safari 10.3 on iOS.

Ref: https://caniuse.com/#search=grid

like image 84
Luke Glazebrook Avatar answered Nov 27 '22 18:11

Luke Glazebrook