
James S. answered 10/09/19
Over 20 years of website design using CSS templates like Bootstrap.
There is no CSS property to detect browser type, but there are ways of doing it.
1) Javascript. You could write some code to detect what type of browser you're in.
And then you could set your styles accordingly.
You could also use Sass or Less to do this.
Sass Mixin
@mixin browser($browsers: Mozilla) {
@each $browser in $browsers {
html[data-browser*=
"#{$browser}"
] & {
@content;
}
}
}
Less Mixin
@import
"for-loop.less"
;
.browser(@browser: Mozilla, @content) {
.for(@browser);
.-each(@value) {
html[data-browser*=
"@{value}"
] & {
@content();
}
}
}