When in CSS3 it is essential to use own tags of each browser -moz-, -webkit-, -ms-, -o-?

3

I understand that there are CSS functions, such as gradient that are not supported in some of the older browsers. I have come across this example:

#grad {
    background: red; /* Para navegadores que no soportan Gradient */
    background: -webkit-linear-gradient(red, yellow); /* Para Safari 5.1 to 6.0 */
    background: -o-linear-gradient(red, yellow); /* Para Opera 11.1 - 12.0 */
    background: -moz-linear-gradient(red, yellow); /* Para Firefox 3.6 - 15 */
    background: linear-gradient(red, yellow); /* Sintaxis standard */
}

If I understand it correctly: background: linear-gradient(red, yellow); would not work on any of those browsers for which a tag statement has been specified from your own browser. That's true? Another question: if I write the following:

background-color: blue;
-moz-background-color: red;

The result will be that in Mozilla the background will be red and in the others blue? And one last question: when you write CSS, how do you know when it is essential to use own tags for each browser or when it is enough to write a single statement?

    
asked by Lukas 08.11.2017 в 15:15
source

2 answers

4
  

If I understand it well: background: linear-gradient (red, yellow); do not   would work on any of those browsers for which it has been   specified a declaration with its own browser tag. That   is it true?

Yes.

  

The result will be that in Mozilla the background will be red and in the rest   blue?

Yes. Depending on which prefix you use, it will be applied in one browser or another.

  

How do you know when it is essential to use own labels of   every browser or when it is enough to write a single statement?

You can research it on the can i use page where it gives details of which browsers a certain css rule is supported and if you need any prefix. For example with grandient it says that the prefix is not required:

Although it would be fair to say that the prefix use is being removed slowly. Personally I have not used it for a while and it works perfectly.

    
answered by 08.11.2017 / 15:25
source
1

Browsers often implement their own standards based on features not fully approved by W3C , so prefixes are necessary in some CSS properties.

What I do to know which property needs prefixes, which do not need and which is supported or not supported by a certain browser is to check this property in the following links:

link

caniuse.com

Another way to solve this type of problem is to use the JavaScript library -prefix-free which adds the prefix of the current browser to a css property only when necessary

    
answered by 08.11.2017 в 15:26