Home >Web Front-end >HTML Tutorial >Analysis of standard mode and weird mode in browsers
means that the browser parses and executes the code in accordance with W3C standards. In this way, it can be rendered with the prescribed syntax, which can be compatible with various browsers and ensure the correct rendering. form display web page.
uses the browser's own way to parse and execute code. Because different browsers parse and execute code differently, we call it weird mode.
Before the standardization of HTML and CSS was completed, each browser had its own different implementation of HTML and CSS parsing, and many old web pages were designed according to these non-standard implementations. of. After the HTML and CSS standards are determined, browsers must implement support for HTML and CSS in accordance with the standards on the one hand, and ensure backward compatibility with non-standard old web page designs on the other. Therefore, modern browsers generally have two rendering modes: standard mode and weird mode. In standard mode, the browser parses and renders the document according to HTML and CSS standards; while in weird mode, the browser parses and renders the document according to the old non-standard implementation.
If you add 8b05045a5be5764f313ed5b9168a17e6
(Note: case insensitive) to your page, it is equivalent to turning on standards mode . That is, as shown in the following code:
<!DOCTYPE html> <html> <head> <meta charset="UTF-8"> <title></title> </head> <body> </body> </html>
If omitted, the browser will use a rendering mode that does not meet certain standards.
Handling differences in box model: The width and height of the standard CSS box model are equal to the height and width of the content area, and do not include padding and borders. However, the width and height of the box model implemented by browsers before IE6 are calculated by including padding. and borders. Therefore, for IE, the width and height calculation methods of the box model in weird mode and standard mode are different;
Vertical alignment of inline elements: Many early Browsers align images to the bottom border of the box that contains them, although the CSS specification requires that they be aligned to the baseline of the text within the box. In standards mode, Gecko-based browsers will be aligned to the baseline, while in quirks mode they will be aligned to the bottom. The most direct example is the display of pictures. In standard mode, the image is not aligned with the bottom border of the parent element. If you look carefully, you will find that there is a small gap between the image and the bottom border of the parent element. That's because in standard mode, images are baseline aligned. In weird mode, this problem does not exist.
The above is the detailed content of Analysis of standard mode and weird mode in browsers. For more information, please follow other related articles on the PHP Chinese website!