The first page of document (not frontmatter) - different background

DmitryS
Posts: 8
Joined: Wed Nov 27, 2019 11:03 am

The first page of document (not frontmatter) - different background

Post by DmitryS » Tue Dec 03, 2019 3:54 pm

Hi again.
Please tell me how to provide the first page of the first chapter with it's own background image.
Is there some named page for this case?
I tried

Code: Select all

    @page :first {
background-image: url(page_background.svg);
    }
but it works exactly like

Code: Select all

"@page chapter:first"
.

Costin
Posts: 634
Joined: Mon Dec 05, 2011 6:04 pm

Re: The first page of document (not frontmatter) - different background

Post by Costin » Thu Dec 05, 2019 1:20 pm

Hello,

There is no dedicated named-page for the first page of the first chapter, but you could create a named-page of your own for this use-case.
More specific, you could set an "outputclass" attribute on the 1st chapter in your DITA Map / Bookmap, then match it through a CSS selector in your customization CSS and set a dedicated page style for it. Then, you should just select the very first page in the page sequence.

Let's say in your Map, you set

Code: Select all

outputclass="firstChapter"
, then in your customization CSS use:

Code: Select all

[class~="map/map"] > [class~="firstChapter"]{
	page: firstPage-firstChapter;
	border: 1px solid red;
}

@page firstPage-firstChapter:first {
	background-image: url("page_background.svg");
}
Best Regards,
Costin
Costin Sandoi
oXygen XML Editor and Author Support

Post Reply