100% 宽度 flexbox 内的额外边距

Extra margin within 100% width flexbox

我想按照 material 设计制作一个应用栏。

我写的代码尝试使用 100% 宽度的 flexbox 来绘制它。

.appbar {
  display: flex;
  flex-direction: row;
  align-items: center;

  width: 100%;
  height: 48px;

  box-sizing: border-box;
  box-shadow: 0 2px 5px 0 rgba(0, 0, 0, 0.46);
}

但是我在我的应用栏中获得了额外的保证金。为什么会这样?

添加margin: 0; padding: 0;body

 body{
  margin: 0;
padding: 0;
 }
 .appbar {
  display: flex;
  flex-direction: row;
  align-items: center;
  background-color: red;

  width: 100%;
  height: 48px;

  box-sizing: border-box;
  box-shadow: 0 2px 5px 0 rgba(0, 0, 0, 0.46);
}
<div class="appbar"></div>