The margin and padding of various elements have been cleared, so why is the height of < body > 21px at this time?

:
<!DOCTYPE html>
<html>
<head>
  <meta charset="utf-8">
  <title>JS Bin</title>
  <style type="text/css">
      *{
          margin:0 ;
          padding: 0;
      }
  </style>
</head>
<body>
    <img src="" alt=""/>
</body>
</html>
marginpadding,
<body>21px?<body>?

Jul.02,2022

there is a blank box called "strut" in the inline box model, which exists in front of each "row box" and has the 0 width of the element's font and line height attribute. If you set html {font-size: 0}, the body height will become 0


because there are blank characters in the body tag, and the browser default font size is 16px. Then add the row height (how much you forget), and it adds up to 21px. If you replace the tag with , it will have the same effect. You can try to set the font-size of body to 0, so the height of body is 0.


img elements are inline elements. Combined with what you said above, with a blank box, that is, there will be a line height without a font

Menu