javascript - 向下移动页面的整个 html 内容?
问题描述
我想使用 javascript 在页面中插入标题。我不想隐藏原始内容中的任何内容,只想在上面添加一个已修复的标题。请记住,我不知道我要操作的页面的内容。
我尝试在 body 元素中添加一个 margin-top:
body{
margin-top: 40px;
}
但是如果有任何位置固定的元素:
.header{
position: fixed;
top: 0;
}
它们将保留在页面顶部。
你有什么建议吗?
解决方案
尝试
body{
padding-top: 40px;
}
header {
position: fixed;
top: 40px;
}
推荐阅读
- c# - 需要在 OnClick 事件期间更改标签文本。带有 C# 后端的 ASP 页面
- python - python datetime.strptime [0-23] vs [1-24]
- json - 如何在颤振中创建嵌套的json对象
- uitableview - 如果滚动到底部太快,JavaFX TableView 会崩溃,自定义单元格也会变得不合逻辑
- python - 元组数组中最大元素的索引
- php - Ajax 发布请求后不显示结果
- swagger - OAS3 指定的服务版本控制
- python - 获取具有特定依赖项的 conda 包的版本
- url-parameters - Apostrophecms : 如何通过斜杠在 url 中添加 url 参数
- java - 线程“主”java.lang.NoClassDefFoundError 中的异常:org/springframework/context/support/ClassPathXmlApplicationContext