Forum Documentation

How to hide the footer on the first page?

ralphbrabante
Hi,

I have my footer section and I'm using this code

Page <span id="pagenumber">&nbsp;</span> of <span id="pagecount">&nbsp;</span>

For the page numbering.

I need to override it so that the page number will only show starting on the second page and it should be hidden on the first page which is the cover page.

I tried using

@page: first {
@bottom {
content: none;
}
}

But no luck.
mikeday
That looks like a syntax error, please try "@page :first" (note the space after the @page). Prince should give an error message for this.
pjrm
By "after the @page", mikeday means "after rather than before": i.e. the important thing is that there mustn't be a space between the colon and the "first".

Another problem with the above is that there is no @bottom in CSS: only @bottom-left, @bottom-center and @bottom-right [and also @bottom-left-corner and @bottom-right-corner, though it's rare to place content in these corner regions].

How to suppress content would depend on how the rule that you want to override was expressed (which page region, and the specificity of the @page selector used), but the following is quite likely to do the trick:

@page :first {
    @bottom-left { content: none; }
    @bottom-center { content: none; }
    @bottom-right { content: none; }
}

pjrm
[Oops, I mean “after the ‘@page’ rather than between colon and ‘first’”.]
pjrm
I stand corrected: @bottom is no longer part of css-page-3, having been removed in 2004, but Prince still accepts it, treating it as a synonym for @bottom-center.

(I would suggest sticking to the standard @bottom-center, but that isn't the cause of the problem you had.)