Search code examples
phpcssdompdf

How to put the first different header in DomPDF


I'm using the following html (Print Header Footer Example) as a template, but I'd like to put the first different header.

My CSS doesn't work

I create a a inside

I added the CSS below:

.headerc {
  background-color: rgb(4, 255, 0);
}

.headerc:first {
   background-color: blue;
}

But all a gets .headerc, I'd like the first of a to receive the stylization of the .headerc:first


Solution

  • I guess :first is not a valid pseudo class selector as used in your code

    See https://developer.mozilla.org/en-US/docs/Web/CSS/:first

    And to show or hide elements of a printed page, you can use @media print

    https://developer.mozilla.org/en-US/docs/Web/CSS/@media#media_types

    See css @media print -> https://www.sitepoint.com/css-printer-friendly-pages/