为什么页脚不占 100% 宽度?

问题描述 投票:0回答:1

我有这个简单的 React 应用程序,我的页脚不占 100% 宽度(我看到左侧和右侧有小空白)。谁能告诉我我错过了什么吗?

这里是现场演示

这是我的CSS:

.App {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.footer {
  margin-top: auto;
  background-color: #000;
  color: #fff;
  height: 50px;
  display: flex;
  justify-content: center;
  align-items: center;
  font-size: 12px;
  padding: 25px 0;
}



应用程序.tsx

  return (
     <div className="App">
       <Footer />
     </div>
    );


我的问题的图片:

enter image description here

css reactjs
1个回答
0
投票

body元素默认有8px的边距,你把它去掉了吗?如果没有,您只需在 .css 文件中添加以下代码即可:

body {
  margin: 0px;
}

希望它对您有帮助,如果这不是您的情况,请随时在这里发表评论以提供更多详细信息

© www.soinside.com 2019 - 2024. All rights reserved.