英文:
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/
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论