Browsers remove extra spaces when displaying an HTML file.
Yes, When displaying an HTML file browsers remove extra spaces in the HTML code. Normally, setting margin:0 and padding:0 for the HTML and body elements, as you have done, should be enough to remove all spacing around the page.
For example, if you write the HTML code as below,
The output will be as follows:
Which HTML5 element defines navigation links?
Which HTML5 element is used to display a scalar measurement within a known range?
Which input type defines a week and year control (no time zone)?
Which input type defines a slider control?
In HTML5, which attribute is used to specify that an input field must be filled out?