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/09-size-and-scroll/2-scrollbar-width/solution.md
+4-4Lines changed: 4 additions & 4 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,16 +1,16 @@
1
-
To get the scrollbar width, we can create an element with the scroll, but without borders and paddings.
1
+
Per ricavare la larghezza della barra di scorrimento, possiamo creare un elemento con scorrimento ma senza bordi e padding.
2
2
3
-
Then the difference between its full width `offsetWidth`and the inner content area width `clientWidth`will be exactly the scrollbar:
3
+
In quel caso la sottrazione tra la larghezza totale `offsetWidth`e la larghezza dell'area interna del contenuto `clientWidth`equivarrà esattamente alla larghezza della barra di scorrimento:
4
4
5
5
```js run
6
-
//create a div with the scroll
6
+
//creiamo un div con scorrimento
7
7
let div =document.createElement('div');
8
8
9
9
div.style.overflowY='scroll';
10
10
div.style.width='50px';
11
11
div.style.height='50px';
12
12
13
-
//must put it in the document, otherwise sizes will be 0
13
+
//dobbiamo inserirlo nel flusso del documento, altrimenti le dimensioni saranno pari a 0
Copy file name to clipboardExpand all lines: 2-ui/1-document/09-size-and-scroll/2-scrollbar-width/task.md
+4-4Lines changed: 4 additions & 4 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -2,10 +2,10 @@ importance: 3
2
2
3
3
---
4
4
5
-
# What is the scrollbar width?
5
+
# Qual è la larghezza della barra di scorrimento?
6
6
7
-
Write the code that returns the width of a standard scrollbar.
7
+
Scrivete il codice che restituisca la larghezza di una barra di scorrimento standard.
8
8
9
-
For Windows it usually varies between `12px`and`20px`. If the browser doesn't reserve any space for it (the scrollbar is half-translucent over the text, also happens), then it may be`0px`.
9
+
Per Windows solitamente varia tra `12px`e`20px`. Se il browser non le riserva alcuno spazio (capita che la barra di scorrimento appaia semi-opaca sopra il testo), allora può essere`0px`.
10
10
11
-
P.S. The code should work for any HTML document, do not depend on its content.
11
+
P.S. Il codice dovrebbe funzionare per ogni documento HTML indipendentemente dal contenuto.
0 commit comments