Why do browsers render the same page in different ways?

1

I'd like to know why browsers read the same page (HTML, CSS, and scripts) and the result displayed is different in some cases.

    
asked by anonymous 24.03.2017 / 20:45

2 answers

2

Within the browser, the part responsible for reading and interpreting HTML and CSS is called the rendering engine or rendering engine ), and there are several different engines in the market, so the page is presented differently.

It can be said that the rendering engine is one of the main components of the browser, and some rendering engines became famous and began to be used by more than one browser.

For example, the WebKit is used by # (Apple), and was used by Opera and by Google Chrome until recently, when it was changed by Blink .

There are also the JavaScript Interpreters , whose purpose is to interpret and execute the JavaScript code of the page, and which are also reused by more than one browser, such as Google's V8 and SpiderMonkey and the Rhino from Mozilla .

    
24.03.2017 / 21:51
1

The fact that a lot of browsers adopt different rendering mechanisms makes it one of the main reasons for this to happen, for example:

  • In some browsers, for example, the text fonts used are not the same, and sometimes this can even vary depending on SO , however when a font is not specified, it is up to the browser to decide.
  • Some browsers take more time to implement certain features, comparison to others.
  • The specifications are ambiguous, and can be interpreted different forms by the respective providers of these browsers - something that has been reduced thanks to HTML5.
  • Use of different resources by web coders, examples you can see -webkit-* when using CSS .
  • Bugs

Still speaking of engines, of all browsers currently in existence, I believe that currently does not use the same engine, either for or for < > scripts .

Otherwise there are several other issues that are entirely the responsibility of the encoder, or almost so:

  • Not everyone who programs, follows language specifications, this applies even to HTML - simple statements like <!doctype *> or even shiv that arrives more like arrangement and so on.
  • Use of unstable resources depending on the environment - apply styles with js instead of css .

And several more of these. But I believe that the biggest problem is the structuring of the code HTML - semantics, sketch etc. - and of the CSS - properties - otherwise , the rest is less I think.

References

24.03.2017 / 22:45