Why do browsers create a predefined stock in all web pages?

Why do all * browsers have a size of arbitrary size in the <body> element of all web pages? . I am not surprised by this since I have been building web pages for many years, but I just assumed that this is part of the specification, so the text inside the <strong> should be bold. But as you can see from HTML5 , HTML 4.01 , HTML 4.0 , HTML 3.2, and even HTML 2.0 and RFC Definition , default styles are never mentioned!

I canโ€™t find any definitions of HTML before 2.0, which was released in the world in 1995, so why all * browsers insert a very specific brand of 8px on all web pages , especially on the days when every web site removes it in the first few CSS lines (even HTML 4.01 spec stylesheet is this) or normalize / reset stylesheet? Of course, it can be argued that ancient websites like the aforementioned HTML 3.2 specifications rely on this, but they really don't look bad without a box (try deleting it with your browser inspector).

* on "all browsers", I mean all versions of Chrome, Firefox, IE, Opera and Safari, including all related obsolete versions, beta, alpha and night hours on this issue.

+6
source share
3 answers

Browsers should be rendered by default (author styles did not exist when HTML was first introduced and is still an optional extra today).

If there was no field / padding on body / html, the text will work against the border of the window and the toolbar, where it would be very difficult to read (which would be a bad choice for default rendering).

why do all browsers insert a very specific 8px value on all web pages

"But it looks different in Netscape." Browsers copied the default rendering from each other in order to compensate for page authors and only think about one browser.

where each website deletes it in the first few lines of CSS

Not every site. This is a common (but not universal) practice for sites that will include a stylesheet, but not all sites.

+5
source

The stylesheet that you mention at http://www.w3.org/StyleSheets/TR/W3C-REC removes the field, but also uses an addition to the body, moving text away from the browser is chrome for readability.

Browsers must have at least some default style for HTML elements in order to convey hierarchy and structure.

Update: You can view the stylesheets of the user agent as follows:

+3
source

To add a little to the other answers, web browsers were sold very differently in the 90s than they are today, and they also included different components. One of these components was included in the Netscape package (remember that at that time Netscape was the only dog โ€‹โ€‹in town and you had to buy it) was an HTML editor called Netscape Composer . I would suggest that when Microsoft released IE to compete, they probably had some kind of similar feature, thus using their own default style (although I donโ€™t remember what it was, I didnโ€™t even think about to develop then). My best guess is that these HTML editor features contributed, at least to some degree, to the default styles for different web browsers.

+1
source

Source: https://habr.com/ru/post/956649/


All Articles