bkardell / css-observers

MIT License
1 stars 0 forks source link

Does CSS have any concept of <area>? #10

Open tomhodgins opened 4 years ago

tomhodgins commented 4 years ago

If I'm using Intersection Observer and observing the intersection ratio, I'm not sure how this works for non-rectangular elements but I assume it's calculating the total surface area of the element (area = width * height for rectangles), so how would I describe how to apply a style when the observed area is half present:

div::observer {
  observe-intersection-ratio: half ???;
}

It's not <length-percentage> because it's not a length. It feels like there should be an <area-percentage> but that would require there to be a concept of <area>. How should we describe this?

bkardell commented 4 years ago

I would think here these would be mapped to thresholds since they map very well to this mental model.. My understanding of this is that it is always based on the clientRects, so, there wouldn't be a concept of non-rectangular things by this definition (I think).