Skip to content

Commit 34b8e1a

Browse files
authored
Merge pull request #408 from 80001/patch-8
Update solution.md
2 parents c81265a + f57da0b commit 34b8e1a

File tree

1 file changed

+5
-5
lines changed
  • 2-ui/1-document/09-size-and-scroll/6-width-vs-clientwidth

1 file changed

+5
-5
lines changed
Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
Differences:
1+
Відмінності:
22

3-
1. `clientWidth` is numeric, while `getComputedStyle(elem).width` returns a string with `px` at the end.
4-
2. `getComputedStyle` may return non-numeric width like `"auto"` for an inline element.
5-
3. `clientWidth` is the inner content area of the element plus paddings, while CSS width (with standard `box-sizing`) is the inner content area *without paddings*.
6-
4. If there's a scrollbar and the browser reserves the space for it, some browser substract that space from CSS width (cause it's not available for content any more), and some do not. The `clientWidth` property is always the same: scrollbar size is substracted if reserved.
3+
1. `clientWidth` є числовим, а `getComputedStyle(elem).width` повертає рядок із `px` в кінці.
4+
2. `getComputedStyle` може повертати нечислову ширину, наприклад `"auto"` для вбудованого елемента.
5+
3. `clientWidth` це внутрішня область вмісту елемента плюс відступи, тоді як ширина CSS (зі стандартним `box-sizing`) це внутрішня область вмісту *без відступів*.
6+
4. Якщо є смуга прокрутки і браузер резервує для неї простір, деякі браузери віднімають цей простір із ширини CSS (тому що він більше не доступний для вмісту), а деякі ні. Властивість `clientWidth` завжди однакова: розмір смуги прокрутки віднімається при її наявності.

0 commit comments

Comments
 (0)