d2jsp
Log InRegister
d2jsp Forums > Off-Topic > Computers & IT > Programming & Development > Cross Browser Support > Css Grid
Add Reply New Topic New Poll
Member
Posts: 6,554
Joined: Feb 7 2018
Gold: 36.00
Dec 26 2019 06:42pm
If I'm using css grid for my layouts, how would I go about solving the IE and older ios not supporting it? Would I need a separate css file for those browsers?

I've tried using this, but the modern browsers are still using float and width % instead of using the grid layout

Code
.gallery > * {
float: left;
width: 25%;
}

@supports (display:grid) {
.gallery {
display: grid;
grid-template-columns: 1fr 1fr;
margin-top: 2rem;
@media screen and (min-width: $largephone-bp) {
grid-template-columns: 1fr 1fr;
}
@media screen and (min-width: $tablet-bp) {
grid-template-columns: 1fr 1fr 1fr 1fr;
}
}
}


I tried using @supports not (display:grid)

But that's not supported on IE either..

This post was edited by Strickland on Dec 26 2019 06:43pm
Member
Posts: 2,619
Joined: May 21 2004
Gold: 21,934.00
Dec 26 2019 07:32pm
You might be able to get by with a mix of autoprefixer and modernizer.

If you're trying to do things "the right way" and not just shim existing code and hope it works, separate css files are the way to go.
Member
Posts: 6,554
Joined: Feb 7 2018
Gold: 36.00
Dec 26 2019 07:33pm
Quote (frixionburne @ Dec 26 2019 05:32pm)
You might be able to get by with a mix of autoprefixer and modernizer.

If you're trying to do things "the right way" and not just shim existing code and hope it works, separate css files are the way to go.


Would I be using javascript to detect which browser they are using, and replace the css source?
Member
Posts: 2,619
Joined: May 21 2004
Gold: 21,934.00
Dec 26 2019 07:34pm
You could do it with JS I guess, but that sounds insane. In most cases you use conditional includes: https://www.sitepoint.com/internet-explorer-conditional-comments/
Member
Posts: 6,554
Joined: Feb 7 2018
Gold: 36.00
Dec 26 2019 07:39pm
Quote (frixionburne @ Dec 27 2019 02:34pm)
You could do it with JS I guess, but that sounds insane. In most cases you use conditional includes: https://www.sitepoint.com/internet-explorer-conditional-comments/


Okay I’ll give that a try, thank you :)
Member
Posts: 12,703
Joined: May 17 2013
Gold: 12,935.00
Dec 27 2019 12:11am
stop supporting dead browsers
Member
Posts: 2,619
Joined: May 21 2004
Gold: 21,934.00
Dec 27 2019 02:52pm
Quote (Klexmoo @ 27 Dec 2019 01:11)
stop supporting dead browsers


Start convincing clients to do so, then I won't have to.
Go Back To Programming & Development Topic List
Add Reply New Topic New Poll