Custom style in first page
See original GitHub issueIts possible to have a different style for the first page of a document?
<!DOCTYPE html>
<html>
<head>
<style>
/* Something like this is possible? */
@page :first header {
background-color: red;
}
/* Or this? */
@page :first {
header {
background-color: red;
}
}
@page {
size: letter portrait;
@top-left {
content: element(header-content);
}
}
header {
position: running(header-content);
}
.page-break {
page-break-after: always;
}
</style>
</head>
<body>
<header>
<h1>Header text</h1>
</header>
Some text
<div class="page-break"></div>
More text
</body>
</html>
Issue Analytics
- State:
- Created 3 years ago
- Comments:5 (2 by maintainers)
Top Results From Across the Web
Customize or create new styles - Microsoft Support
If you want formatting choices that are not available from the built-in styles and themes available in Word, you can modify an existing...
Read more >How to Create a Custom Heading Style in ... - Erin Wright Writing
... heading style in Microsoft Word. Plus, save a custom heading style and delete a custom heading style. ... How to Create a...
Read more >Word 2016: Applying and Modifying Styles - GCF Global
To apply a style set: Style sets include a combination of title, heading, and paragraph styles. Style sets allow you to format all...
Read more >Setting up a Heading 1 Example - Microsoft Word for ...
For example, your chapter titles and front matter titles (e. g., Dedication, ... On the Home Ribbon, in the Styles Group, right-click on...
Read more >How to Create a Custom Heading Style in Microsoft Word
Learn how to create your own custom heading style in Microsoft Word. In addition, learn how to save a custom heading style for...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Hello!
I think that there’s no way to change the style of the elements drawn on the first page.
@page
rules can only contain page properties, and properties defined there only apply to the page and the page margins, not to the page content.In real cases, you often know what’s on your first page, and you can add classes accordingly (even if it’s not a “clean” solution, I agree). But there are some cases when you really want to change the style of the content only on the first page, and … currently you can’t.
Reporting an issue to the CSSWG may be the best solution to get a way to solve this issue.
Thanks @liZe. I will try to report it.