Alter div padding or margins only when element falls at top of page

51 Views Asked by At

I'm writing a book. My CSS styles for vertical spacing of various elements (chapter, section, subsection, etc.) work fine, except when the section, subsection, etc., element falls at the top of the page of paged-media. I can manually tweak the ones that are CURRENTLY at the top of a page, but any changes that reflow the text mess it up (move it off of the top of a page).

I'm hoping to find a selector that says, "If this element appears at the top of a page (following automatic or manual page break) then select it.

So far, all I have been able to do is use an additional class, e.g. "topofpage", which I stupidly manually add to an element.

0

There are 0 best solutions below