You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: 2-ui/1-document/10-size-and-scroll-window/article.md
+9-9Lines changed: 9 additions & 9 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -21,24 +21,24 @@ I browser supportano inoltre proprietà come `window.innerWidth/innerHeight`. Se
21
21
22
22
Se esiste una barra di scorrimento ed occupa uno spazio, `clientWidth/clientHeight` forniscono la larghezza e l'altezza al netto della barra (la sottraggono). In altre parole restituiscono le dimensioni della parte visibile del documento disponibile per il contenuto.
23
23
24
-
`window.innerWidth/innerHeight` includono la barra di scorrimento.
24
+
`window.innerWidth/innerHeight` includono invece la barra di scorrimento.
25
25
26
-
If there's a scrollbar, and it occupies some space, then these two lines show different values:
26
+
Se la barra di scorrimento è presente ed occupa uno spazio, allora queste due linee di codice mostreranno dei valori differenti:
27
27
```js run
28
-
alert( window.innerWidth ); //full window width
29
-
alert( document.documentElement.clientWidth ); //window width minus the scrollbar
28
+
alert( window.innerWidth ); //larghezza della finestra comprensiva di barra di scorrimento
29
+
alert( document.documentElement.clientWidth ); //larghezza della finestra barra esclusa
30
30
```
31
31
32
-
In most cases, we need the *available* window width in order to draw or position something within scrollbars (if there are any), so we should use`documentElement.clientHeight/clientWidth`.
32
+
Nella maggior parte dei casi abbiamo bisogno della larghezza delle finestra *disponibile* per disegnare o posizionare qualcosa all'interno delle barre di scorrimento (se presenti), quindi dovremmo usare`documentElement.clientHeight/clientWidth`.
33
33
````
34
34
35
-
```warn header="`DOCTYPE` is important"
36
-
Please note: top-level geometry properties may work a little bit differently when there's no `<!DOCTYPE HTML>` in HTML. Odd things are possible.
35
+
```warn header="Il `DOCTYPE` è importante"
36
+
Si noti che le proprietà geometriche ad alto livello possono funzionare in modo leggermente differente se non c'è `<!DOCTYPE HTML>` nell'HTML. Si potrebbero verificare comportamenti imprevedibili.
37
37
38
-
In modern HTML we should always write `DOCTYPE`.
38
+
Nell'HTML moderno dovremmo sempre indicare il `DOCTYPE`.
39
39
```
40
40
41
-
## Width/height of the document
41
+
## Larghezza e altezza del documento
42
42
43
43
Theoretically, as the root document element is `document.documentElement`, and it encloses all the content, we could measure the document's full size as `document.documentElement.scrollWidth/scrollHeight`.
0 commit comments