I’m printing a website to PDF. The result is a multipage document with several texts and images on it. Here’s a diagram of what it usually looks like:
<code>Page 1
+-----------------------------+
| |
| A |
| |
| |
| |
| |
| |
| |
| B |
| |
| |
| |
| |
+-----------------------------+
Page 2
+-----------------------------+
| |
| C |
| |
| |
| |
| |
| |
| -------- |
| D |
| |
| |
| |
| |
+-----------------------------+
</code>
<code>Page 1
+-----------------------------+
| |
| A |
| |
| |
| |
| |
| |
| |
| B |
| |
| |
| |
| |
+-----------------------------+
Page 2
+-----------------------------+
| |
| C |
| |
| |
| |
| |
| |
| -------- |
| D |
| |
| |
| |
| |
+-----------------------------+
</code>
Page 1
+-----------------------------+
| |
| A |
| |
| |
| |
| |
| |
| |
| B |
| |
| |
| |
| |
+-----------------------------+
Page 2
+-----------------------------+
| |
| C |
| |
| |
| |
| |
| |
| -------- |
| D |
| |
| |
| |
| |
+-----------------------------+
Element D is a footer on page 2 and it has a border at the top to divide it from element C.
Sometimes though, element D ends up being the first thing on a page, and it looks weird with a border above it:
<code>Page 1
+-----------------------------+
| |
| A |
| |
| |
| |
| |
| |
| |
| B |
| |
| |
| |
| |
+-----------------------------+
Page 2
+-----------------------------+
| -------- |
| D |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
+-----------------------------+
</code>
<code>Page 1
+-----------------------------+
| |
| A |
| |
| |
| |
| |
| |
| |
| B |
| |
| |
| |
| |
+-----------------------------+
Page 2
+-----------------------------+
| -------- |
| D |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
+-----------------------------+
</code>
Page 1
+-----------------------------+
| |
| A |
| |
| |
| |
| |
| |
| |
| B |
| |
| |
| |
| |
+-----------------------------+
Page 2
+-----------------------------+
| -------- |
| D |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
+-----------------------------+
Can I use CCS selectors to target element D but only in the cases where it happens to be the first element on a printed page, so I can remove the border above it?
1