Question about vendor prefixes

Hello,
Before several weeks I have solved SCSS chalenge but today I decide to pass it again .
And when I started with @mixins here was such example

/* As features are added to browsers, 
CSS rules using them may need vendor prefixes.
 Consider "box-shadow":*/
div {
  -webkit-box-shadow: 0px 0px 4px #fff;
  -moz-box-shadow: 0px 0px 4px #fff;
  -ms-box-shadow: 0px 0px 4px #fff;
  box-shadow: 0px 0px 4px #fff;
}

And here I have thought about ‘‘vendor prefixes’’, in the WEB code here is a lot different properties, and how to determine which of properties need ‘‘vendor prefixes’’ rules and which not?

1 Like

just look up the specific property in the MDN website. They have a table listing the browser compatibility.
for eg. If you are looking up box-shadow,

scroll all the way down till you get to the “Browser Compatibility” section then
read the table to understand how to implement box-shadow across different browsers.

This is how you find out if they’re necessary:

https://caniuse.com/

In practise, you would almost never add vendor prefixes manually, you would generally use a tool called Autoprefixer. Using it directly is probably a bit beyond where you’re at at the minute, but you can have it applied to your projects on CodePen if you go into settings > CSS and tick the box to turn autoprefixer on.

1 Like

I should warn you though that some companies do not allow their developers to make use of tools such as Autoprefixer in their environments (due to legal issues with copyrights and worry about diluting their own copyright). Some do allow it but you have to get lawyers involved to evaluate the license it is distributed under first.

1 Like

This is true but incredibly uncommon. Application dependencies, yes, it is kinda common in certain sectors to have them vetted. Build tools, no, it isn’t, because if you have to have build tools vetted by lawyers it’s almost impossible to do software development. It’ll happen (military contracts I guess would be a good example?), but it’s near-insanity and therefore not particularly common for most projects. That isn’t in any way saying that the OP won’t go into a job where that is the case. It’s just statistically very unlikely that they will be in a job situation where, due to legal requirements, they have to build their own tools to replace the de facto standard ones

1 Like