html - 页眉没有到达边界
问题描述
我的标题总是无法到达窗口的边界,我尝试了很多解决方案,甚至将边距设置为 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% 什么都不做,设置高度只是将其扩展到页面下方。我需要它是可扩展的,因此我使用百分比,但无法弄清楚如何让它不在另一边留下空白。
解决方案
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.
推荐阅读
- python - Python Numba 问题(TypingError: Failed in nopython mode pipeline)
- elasticsearch - ElasticSearch 在区分大小写和不区分大小写搜索之间切换?
- php - 创建一个重定向,将登录用户的用户名添加到 WordPress 中的网站 url
- ansible - 如何从 host_var 文件将变量分配给单个主机
- javascript - 基于javascript中的括号拆分字符串
- node.js - Nodemailer 和 Firebase Cloud Functions 的错误授权 OAuth2 无效
- cookies - Next.js 不会将 django 后端返回的任何 cookie 保存在浏览器 cookie 存储中
- http - 如何创建http服务器
- bash - 在 bash 中使用 EOF 时出现问题
- javascript - DataTable 中 CreatedCell 上的列名