Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
有没有办法为仅在文档的特定页面上生成运行头的打印媒体创建 CSS 样式?
出现在每个页面上的运行头是可能的:
div.divHeader { display: block; position: fixed; top: 0; right: 0; margin: 10px; }
但是如果一个人想在不同的页面上显示不同的标题(例如,一章的开头,或者不同章节的不同标题等)怎么办?
一种方法是使用 PHP。然后您可以编写一个脚本来检查用户在哪个页面上并获取该页面的标题。如果您只使用 HTML 和 CSS,也许您可以在每个文档的正文上设置一个类,然后按照您想要的方式设置它的样式?
例如:页面开始:
<html> <body class="first"> content here </body> </html>
例如:第二页
<html> <body class="second"> content here </body> </html>