- From: Lea Verou <lea@verou.me>
- Date: Tue, 19 Apr 2016 15:07:11 -0400
- To: Florian Rivoal <florian@rivoal.net>
- Cc: Matt Haggard <haggardii@gmail.com>, www-style list <www-style@w3.org>
> On 19Apr, 2016, at 11:11, Florian Rivoal <florian@rivoal.net> wrote: > > This is an interesting use case, with a good news and a bad news. > > The bad news is that you cannot solve this using the kind of pseudo class you suggested. Imagine that you write this: > > div:breaks-on-to-next-page { width: 1px; height 1px; overflow: hidden; } > > Now your element is so small that it no longer breaks onto the next page. So the pseudo class no longer applies. So it is no longer small, so it breaks onto the next page, so the pseudo class applies... Oops. > > This is inherent to the way pseudo classes work, so we cannot have a pseudo class which matches or not depending on the result of layout. Yes we can, and we do: ::first-line. I can almost imagine the CSS WG discussion about cycles if ::first-line was proposed now, yet it's implemented everywhere and works just fine. What you're proposing is a terrible hack which only works in cases where one can just cover up the decoration with pseudo-elements (as pointed out in the replies, this is not always easy). This is issue is very common (in print, in CSS it's not common because people can't do it) to only be solvable with a terrible hack. As you're aware, I run into it in my book too, and had to solve it with a similar terrible hack. I don't understand why we can't have a ::nth-fragment(an+b) pseudo-element, which would either work like ::first-line, or just wouldn't affect layout. i.e. no matter what styling you applied on it, it would not affect fragmentation. If you weren't careful, it would just overflow the page. In practically all cases that would be a non-issue, because the styling one needs to apply to fragments does not actually affect fragmentation. ~Lea
Received on Tuesday, 19 April 2016 19:07:32 UTC