首页 > 解决方案 > 页眉没有到达边界

问题描述

我的标题总是无法到达窗口的边界,我尝试了很多解决方案,甚至将边距设置为 0 也无济于事

  .navbar{
  position: fixed;
  display: flex;
  justify-content: center;
  align-items: center;
  flex-direction: row;
  flex-wrap: wrap;
  background-color:#d4d7de;
  width: 100%;

在此处输入图像描述 如您所见,标题到达最右侧的末尾,但没有到达顶部和底部。将边距设置为 0 什么都不做,将宽度设置为大于 100% 什么都不做,设置高度只是将其扩展到页面下方。我需要它是可扩展的,因此我使用百分比,但无法弄清楚如何让它不在另一边留下空白。

标签: htmlcss

解决方案


Try setting this to your CSS:

* {
  padding: 0;
  margin: 0;
}

By default all elements may have some value set for padding or margin - this removes it for all (*).
This is called CSS reset as it "unstyles" all elements. There is also the process of providing "useful" styles which are equal in all browsers. That would be called normalizing.


推荐阅读