chrome浏览器打印页面 怎样自定义页眉跟页脚???跪求啊!!T—T

?forever 2018-06-28 05:14:47
chrome浏览器打印页面 怎样自定义页眉跟页脚
window.print();

膜拜各位大神,寻求帮助啊····
...全文
1569 4 打赏 收藏 转发到动态 举报
写回复
用AI写文章
4 条回复
切换为时间正序
请发表友善的回复…
发表回复
FatNA 2020-04-29
  • 打赏
  • 举报
回复
楼上的都不行,都会被遮挡,emmmm,去求把
六哲1 2019-11-28
  • 打赏
  • 举报
回复
酷酷的旭 2019-11-28
  • 打赏
  • 举报
回复
HTML结构

<div class="wrapper">
    <div class="content">内容</div>
    <div class="footer">页脚</div>
</div>
CSS
html, body {
    height: 100%;
   }
 
.wrapper {
    position: relative;
    min-height: calc(100% - 40px); //这里可以调整一下
    padding-bottom: 40px;
    box-sizing: border-box;
  }
.footer {
    position: absolute;
    bottom: 0;
    height: 40px;
    width: 100%;
    text-align: center;
    line-height: 40px;
  }
天际的海浪 2018-06-28
  • 打赏
  • 举报
回复

<!doctype html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1" />
<title> 页面名称 </title>
<style type="text/css">
header, footer {
display: none;
}
@media print {
header {
display: block;
}
footer {
display: block;
}
}
</style>
</head>
<body>

<header>页眉</header>

<p>内容</p>

<footer>页脚</footer>

</body>
</html>

87,917

社区成员

发帖
与我相关
我的任务
社区描述
Web 开发 JavaScript
社区管理员
  • JavaScript
  • 无·法
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧