Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Why do I have to address different browsers with a prefix for the same css? [closed]

Tags:

html

css

I am curious, as to why some browsers need a special invitation for the same css layout command. Can anyone enlighten me?

Example: CSS-formatting: box-sizing: border-box; (Please consider the border of my box for dimensions!)

Now here come firefox and safari, and they need a special invitation:

-moz-box-sizing: border-box;
-webkit-box-sizing: border-box;

To a simple cat like myself this seems like saying:

  1. Browsers: The dimensions I gave you count for the borders of my box!
  2. firefox: This also counts for you.
  3. Safari: It goes for you as well.

I mean... why? It is exactly the same syntax! Why do I have to tell the same stuff to a specific browser? I would understand if they need a different syntax.. but exactly the same?! Do they like to hear their names being called?

like image 999
Schroedingers Cat Avatar asked Nov 02 '12 13:11

Schroedingers Cat


People also ask

What is the purpose of using prefixes in CSS?

CSS vendor prefixes, also sometimes known as or CSS browser prefixes, are a way for browser makers to add support for new CSS features before those features are fully supported in all browsers.

Why is CSS different in web browsers?

It look different because each browser has his own CSS style defined. This styles apply to the HTML markup when no other CSS is defined inline or comes from an external CSS file.


2 Answers

This is the result of different browser engines supporting different things. Those directives simply are aimed at telling the browser's rendering engines that you are looking to use a feature that is still in development/testing or not standard in the CSS specification. Note that not all browsers use different rendering engines.

like image 115
thatidiotguy Avatar answered Oct 26 '22 23:10

thatidiotguy


because these properties are not starndardized by the W3C, they are still in draft, therefore vendors implement their own version - that uses prefixes to avoid clashes with other browsers implementation, or the final implementation after the specs are finalized.

like image 38
Luca Avatar answered Oct 27 '22 00:10

Luca