Element sizing in CSS is anything but straight forward, especially as there are loads of non obvious rules applied to elements like text inputs etc
But maybe I am just not as good at CSS as I thought :)
Generally, nearly every element's size comes down to some combination of:
1) Explicit width/height properties (and padding/margin)
2) Special layout mechanisms like filebox or grid
3) The element's contents
4) Its direct parent's dimensions
That's pretty much it. There's really no case I can think of where a grandparent directly drives an element's size (it may drive the parent's size which drives the child's size, but the reach at each individual stage remains short)
But I can still go with this:
I inspect the tab toolbar. I pick a tab and look at the contents of the div. Just inside the actual tab div is a "stack" element, whose width is being set to the size of its contents right now.
The stack is size 50.5x44, and it's display:grid.
It has two visible children. Both of them are 50.5x44, and are display: -moz-box.
I can tell from deep inspection and trial and error that one of those children is setting the size, and the other child is inheriting the size.
But if I don't want to dig around every single sub-div, what can I do to figure out which one is which?
They look the same in the layout inspector, and neither of them has any computed properties relative to width.
For bonus difficulty: If the parent div of the "stack" element tries to grow wider than the stack, the stack will grow to match its width, and the child divs of the stack will also grow to match it. All without any computed properties changing, or the layout inspector noting that anything is different.
So the size of the "stack" element could be set by either its parent or one of its children and I have no idea how to figure out which one except by experimentation. This is not a very pleasant experience.
Ideally, I could get a list of every element competing to set the width of a div, and which one(s) are winning. Less ideally, I could see just which element(s) are currently responsible for the size of a div. But as far as I can tell there's nothing, and I have to blindly search every other related element that has a suspiciously similar size.