如何在DomPDF中设置第一个不同的页眉

huangapple go评论59阅读模式
英文:

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.

我的CSS不起作用

I create a <div class="headerc">a</div> inside <div id="header">

我添加了以下CSS:

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

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

But all <div class="headerc">a</div> gets .headerc, I'd like the first of <div class="headerc">a</div> to receive the stylization of the .headerc:first

英文:

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 <div class="headerc">a</div> inside <div id="header">

I added the CSS below:

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

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

But all <div class="headerc">a</div> gets .headerc, I'd like the first of <div class="headerc">a</div> to receive the stylization of the .headerc:first

答案1

得分: 1

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

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

而要显示或隐藏打印页面的元素,您可以使用@media print

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

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

英文:

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/

huangapple
  • 本文由 发表于 2023年5月13日 08:43:17
  • 转载请务必保留本文链接:https://go.coder-hub.com/76240619.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定