https://github.com/WebComponentsBook/code-examples/blob/61f1a0a1b53110acbe202bff7525689f33149cf1/chapter-6_duvet/duvet.js#L37 If the inner element has a border, just subtracting `clientWidth` from `offsetWidth` wouldn't do, right ? You would have to subtract border width too.