From baed348774c733a86c37bdbcc89e877d5f3291de Mon Sep 17 00:00:00 2001 From: Diogo Marciano Date: Sat, 21 Nov 2026 20:21:12 -0300 Subject: [PATCH 1/3] Translate 'Element size and scrolling' article to Portuguese Includes the 4 exercise subfolders and the referenced sandbox demos (metric.view, cssWidthScroll.view). Translates the prose annotation labels (border, padding, content width, scrollbar, height) in 6 SVGs via images.yml + gulp pipeline; property-name labels (offsetWidth, clientHeight, etc.) are kept as code identifiers. The generic "Ecma Standard" filler paragraph used to demonstrate overflow is left in English in both the SVGs and the live demos, for consistency between them. Co-Authored-By: Claude Sonnet 5 --- .../1-get-scroll-height-bottom/solution.md | 4 +- .../1-get-scroll-height-bottom/task.md | 8 +- .../2-scrollbar-width/solution.md | 8 +- .../2-scrollbar-width/task.md | 8 +- .../4-put-ball-in-center/ball-half/index.html | 4 +- .../4-put-ball-in-center/solution.md | 28 +-- .../solution.view/index.html | 4 +- .../4-put-ball-in-center/task.md | 14 +- .../6-width-vs-clientwidth/solution.md | 10 +- .../6-width-vs-clientwidth/task.md | 6 +- 2-ui/1-document/09-size-and-scroll/article.md | 200 +++++++++--------- .../cssWidthScroll.view/index.html | 2 +- .../metric-client-left-top-rtl.svg | 2 +- .../metric-client-left-top.svg | 2 +- .../metric-client-width-height.svg | 2 +- .../metric-client-width-nopadding.svg | 2 +- .../09-size-and-scroll/metric-css.svg | 2 +- .../metric-offset-width-height.svg | 2 +- .../09-size-and-scroll/metric.view/index.html | 4 +- images.yml | 66 ++++++ 20 files changed, 222 insertions(+), 156 deletions(-) diff --git a/2-ui/1-document/09-size-and-scroll/1-get-scroll-height-bottom/solution.md b/2-ui/1-document/09-size-and-scroll/1-get-scroll-height-bottom/solution.md index 01e073655..29358c391 100644 --- a/2-ui/1-document/09-size-and-scroll/1-get-scroll-height-bottom/solution.md +++ b/2-ui/1-document/09-size-and-scroll/1-get-scroll-height-bottom/solution.md @@ -1,7 +1,7 @@ -The solution is: +A solução é: ```js let scrollBottom = elem.scrollHeight - elem.scrollTop - elem.clientHeight; ``` -In other words: (full height) minus (scrolled out top part) minus (visible part) -- that's exactly the scrolled out bottom part. +Em outras palavras: (altura total) menos (parte rolada para fora no topo) menos (parte visível) -- isso é exatamente a parte rolada para fora na parte de baixo. diff --git a/2-ui/1-document/09-size-and-scroll/1-get-scroll-height-bottom/task.md b/2-ui/1-document/09-size-and-scroll/1-get-scroll-height-bottom/task.md index 796039c2a..90e4977f2 100644 --- a/2-ui/1-document/09-size-and-scroll/1-get-scroll-height-bottom/task.md +++ b/2-ui/1-document/09-size-and-scroll/1-get-scroll-height-bottom/task.md @@ -2,10 +2,10 @@ importance: 5 --- -# What's the scroll from the bottom? +# Qual é a rolagem a partir de baixo? -The `elem.scrollTop` property is the size of the scrolled out part from the top. How to get the size of the bottom scroll (let's call it `scrollBottom`)? +A propriedade `elem.scrollTop` é o tamanho da parte rolada para fora a partir do topo. Como obter o tamanho da rolagem a partir de baixo (vamos chamá-lo de `scrollBottom`)? -Write the code that works for an arbitrary `elem`. +Escreva o código que funcione para um `elem` arbitrário. -P.S. Please check your code: if there's no scroll or the element is fully scrolled down, then it should return `0`. +P.S. Teste seu código: se não houver rolagem ou o elemento estiver totalmente rolado para baixo, então ele deve retornar `0`. diff --git a/2-ui/1-document/09-size-and-scroll/2-scrollbar-width/solution.md b/2-ui/1-document/09-size-and-scroll/2-scrollbar-width/solution.md index 1ba1e5e57..b00c89859 100644 --- a/2-ui/1-document/09-size-and-scroll/2-scrollbar-width/solution.md +++ b/2-ui/1-document/09-size-and-scroll/2-scrollbar-width/solution.md @@ -1,16 +1,16 @@ -To get the scrollbar width, we can create an element with the scroll, but without borders and paddings. +Para obter a largura da barra de rolagem, podemos criar um elemento com rolagem, mas sem bordas e preenchimentos. -Then the difference between its full width `offsetWidth` and the inner content area width `clientWidth` will be exactly the scrollbar: +Então a diferença entre sua largura total `offsetWidth` e a largura da área de conteúdo interna `clientWidth` será exatamente a barra de rolagem: ```js run -// create a div with the scroll +// cria um div com rolagem let div = document.createElement('div'); div.style.overflowY = 'scroll'; div.style.width = '50px'; div.style.height = '50px'; -// must put it in the document, otherwise sizes will be 0 +// precisa colocá-lo no documento, senão os tamanhos serão 0 document.body.append(div); let scrollWidth = div.offsetWidth - div.clientWidth; diff --git a/2-ui/1-document/09-size-and-scroll/2-scrollbar-width/task.md b/2-ui/1-document/09-size-and-scroll/2-scrollbar-width/task.md index b39004cbf..30adb75ae 100644 --- a/2-ui/1-document/09-size-and-scroll/2-scrollbar-width/task.md +++ b/2-ui/1-document/09-size-and-scroll/2-scrollbar-width/task.md @@ -2,10 +2,10 @@ importance: 3 --- -# What is the scrollbar width? +# Qual é a largura da barra de rolagem? -Write the code that returns the width of a standard scrollbar. +Escreva o código que retorna a largura de uma barra de rolagem padrão. -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`. +No Windows, geralmente varia entre `12px` e `20px`. Se o navegador não reservar nenhum espaço para ela (a barra de rolagem fica semitransparente sobre o texto, isso também acontece), então pode ser `0px`. -P.S. The code should work for any HTML document, do not depend on its content. +P.S. O código deve funcionar para qualquer documento HTML, sem depender do seu conteúdo. diff --git a/2-ui/1-document/09-size-and-scroll/4-put-ball-in-center/ball-half/index.html b/2-ui/1-document/09-size-and-scroll/4-put-ball-in-center/ball-half/index.html index 8f855ecfa..d565da9e4 100755 --- a/2-ui/1-document/09-size-and-scroll/4-put-ball-in-center/ball-half/index.html +++ b/2-ui/1-document/09-size-and-scroll/4-put-ball-in-center/ball-half/index.html @@ -29,8 +29,8 @@ let ball = document.getElementById('ball') let field = document.getElementById('field') - // ball.offsetWidth=0 before image loaded! - // to fix: set width + // ball.offsetWidth=0 antes da imagem carregar! + // para corrigir: defina o width ball.style.left = Math.round(field.clientWidth / 2) + 'px' ball.style.top = Math.round(field.clientHeight / 2) + 'px' diff --git a/2-ui/1-document/09-size-and-scroll/4-put-ball-in-center/solution.md b/2-ui/1-document/09-size-and-scroll/4-put-ball-in-center/solution.md index afa1d8f50..0f9f3266b 100644 --- a/2-ui/1-document/09-size-and-scroll/4-put-ball-in-center/solution.md +++ b/2-ui/1-document/09-size-and-scroll/4-put-ball-in-center/solution.md @@ -1,53 +1,53 @@ -The ball has `position:absolute`. It means that its `left/top` coordinates are measured from the nearest positioned element, that is `#field` (because it has `position:relative`). +A bola tem `position:absolute`. Isso significa que suas coordenadas `left/top` são medidas a partir do elemento posicionado mais próximo, que é `#field` (porque ele tem `position:relative`). -The coordinates start from the inner left-upper corner of the field: +As coordenadas começam a partir do canto interno superior-esquerdo do campo: ![](field.svg) -The inner field width/height is `clientWidth/clientHeight`. So the field center has coordinates `(clientWidth/2, clientHeight/2)`. +A largura/altura interna do campo é `clientWidth/clientHeight`. Então o centro do campo tem coordenadas `(clientWidth/2, clientHeight/2)`. -...But if we set `ball.style.left/top` to such values, then not the ball as a whole, but the left-upper edge of the ball would be in the center: +...Mas se definirmos `ball.style.left/top` com esses valores, então não será a bola como um todo, mas o canto superior-esquerdo da bola que ficará no centro: ```js ball.style.left = Math.round(field.clientWidth / 2) + 'px'; ball.style.top = Math.round(field.clientHeight / 2) + 'px'; ``` -Here's how it looks: +Veja como fica: [iframe height=180 src="ball-half"] -To align the ball center with the center of the field, we should move the ball to the half of its width to the left and to the half of its height to the top: +Para alinhar o centro da bola com o centro do campo, devemos mover a bola em metade da sua largura para a esquerda e em metade da sua altura para cima: ```js ball.style.left = Math.round(field.clientWidth / 2 - ball.offsetWidth / 2) + 'px'; ball.style.top = Math.round(field.clientHeight / 2 - ball.offsetHeight / 2) + 'px'; ``` -Now the ball is finally centered. +Agora a bola está finalmente centralizada. -````warn header="Attention: the pitfall!" +````warn header="Atenção: a armadilha!" -The code won't work reliably while `` has no width/height: +O código não vai funcionar de forma confiável enquanto a `` não tiver width/height: ```html ``` ```` -When the browser does not know the width/height of an image (from tag attributes or CSS), then it assumes them to equal `0` until the image finishes loading. +Quando o navegador não sabe a largura/altura de uma imagem (a partir de atributos da tag ou do CSS), ele assume que elas são iguais a `0` até que a imagem termine de carregar. -So the value of `ball.offsetWidth` will be `0` until the image loads. That leads to wrong coordinates in the code above. +Então o valor de `ball.offsetWidth` será `0` até a imagem carregar. Isso leva a coordenadas erradas no código acima. -After the first load, the browser usually caches the image, and on reloads it will have the size immediately. But on the first load the value of `ball.offsetWidth` is `0`. +Depois do primeiro carregamento, o navegador geralmente armazena a imagem em cache, e nos recarregamentos ela terá o tamanho imediatamente. Mas no primeiro carregamento o valor de `ball.offsetWidth` é `0`. -We should fix that by adding `width/height` to ``: +Devemos corrigir isso adicionando `width/height` à ``: ```html ``` -...Or provide the size in CSS: +...Ou fornecer o tamanho no CSS: ```css #ball { diff --git a/2-ui/1-document/09-size-and-scroll/4-put-ball-in-center/solution.view/index.html b/2-ui/1-document/09-size-and-scroll/4-put-ball-in-center/solution.view/index.html index 9f21e5421..f05d4a58d 100755 --- a/2-ui/1-document/09-size-and-scroll/4-put-ball-in-center/solution.view/index.html +++ b/2-ui/1-document/09-size-and-scroll/4-put-ball-in-center/solution.view/index.html @@ -26,8 +26,8 @@ diff --git a/2-ui/1-document/09-size-and-scroll/4-put-ball-in-center/task.md b/2-ui/1-document/09-size-and-scroll/4-put-ball-in-center/task.md index f56e0858b..66109a64e 100644 --- a/2-ui/1-document/09-size-and-scroll/4-put-ball-in-center/task.md +++ b/2-ui/1-document/09-size-and-scroll/4-put-ball-in-center/task.md @@ -2,19 +2,19 @@ importance: 5 --- -# Place the ball in the field center +# Coloque a bola no centro do campo -Here's how the source document looks: +Veja como fica o documento original: [iframe src="source" edit link height=180] -What are coordinates of the field center? +Quais são as coordenadas do centro do campo? -Calculate them and use to place the ball into the center of the green field: +Calcule-as e use-as para colocar a bola no centro do campo verde: [iframe src="solution" height=180] -- The element should be moved by JavaScript, not CSS. -- The code should work with any ball size (`10`, `20`, `30` pixels) and any field size, not be bound to the given values. +- O elemento deve ser movido por JavaScript, não por CSS. +- O código deve funcionar com qualquer tamanho de bola (`10`, `20`, `30` pixels) e qualquer tamanho de campo, sem ficar amarrado aos valores dados. -P.S. Sure, centering could be done with CSS, but here we want exactly JavaScript. Further we'll meet other topics and more complex situations when JavaScript must be used. Here we do a "warm-up". +P.S. Claro, a centralização poderia ser feita com CSS, mas aqui queremos exatamente JavaScript. Mais adiante vamos encontrar outros tópicos e situações mais complexas em que o JavaScript precisa ser usado. Aqui fazemos um "aquecimento". diff --git a/2-ui/1-document/09-size-and-scroll/6-width-vs-clientwidth/solution.md b/2-ui/1-document/09-size-and-scroll/6-width-vs-clientwidth/solution.md index 0a18bd86e..2d781088c 100644 --- a/2-ui/1-document/09-size-and-scroll/6-width-vs-clientwidth/solution.md +++ b/2-ui/1-document/09-size-and-scroll/6-width-vs-clientwidth/solution.md @@ -1,6 +1,6 @@ -Differences: +Diferenças: -1. `clientWidth` is numeric, while `getComputedStyle(elem).width` returns a string with `px` at the end. -2. `getComputedStyle` may return non-numeric width like `"auto"` for an inline element. -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*. -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. +1. `clientWidth` é numérico, enquanto `getComputedStyle(elem).width` retorna uma string com `px` no final. +2. `getComputedStyle` pode retornar uma largura não numérica, como `"auto"`, para um elemento inline. +3. `clientWidth` é a área de conteúdo interna do elemento mais os preenchimentos, enquanto a largura CSS (com o `box-sizing` padrão) é a área de conteúdo interna *sem os preenchimentos*. +4. Se houver uma barra de rolagem e o navegador reservar espaço para ela, alguns navegadores subtraem esse espaço da largura CSS (já que ele não está mais disponível para o conteúdo), e alguns não subtraem. A propriedade `clientWidth` é sempre a mesma: o tamanho da barra de rolagem é subtraído se ela estiver reservada. diff --git a/2-ui/1-document/09-size-and-scroll/6-width-vs-clientwidth/task.md b/2-ui/1-document/09-size-and-scroll/6-width-vs-clientwidth/task.md index 5378c5915..908c9231b 100644 --- a/2-ui/1-document/09-size-and-scroll/6-width-vs-clientwidth/task.md +++ b/2-ui/1-document/09-size-and-scroll/6-width-vs-clientwidth/task.md @@ -2,8 +2,8 @@ importance: 5 --- -# The difference: CSS width versus clientWidth +# A diferença: width do CSS versus clientWidth -What's the difference between `getComputedStyle(elem).width` and `elem.clientWidth`? +Qual é a diferença entre `getComputedStyle(elem).width` e `elem.clientWidth`? -Give at least 3 differences. The more the better. +Dê pelo menos 3 diferenças. Quanto mais, melhor. diff --git a/2-ui/1-document/09-size-and-scroll/article.md b/2-ui/1-document/09-size-and-scroll/article.md index 66f28115f..aa8691649 100644 --- a/2-ui/1-document/09-size-and-scroll/article.md +++ b/2-ui/1-document/09-size-and-scroll/article.md @@ -1,16 +1,16 @@ -# Element size and scrolling +# Tamanho e rolagem de elementos -There are many JavaScript properties that allow us to read information about element width, height and other geometry features. +Existem muitas propriedades JavaScript que nos permitem ler informações sobre a largura, altura e outras características geométricas do elemento. -We often need them when moving or positioning elements in JavaScript. +Frequentemente precisamos delas ao mover ou posicionar elementos em JavaScript. -## Sample element +## Elemento de exemplo -As a sample element to demonstrate properties we'll use the one given below: +Como elemento de exemplo para demonstrar as propriedades, vamos usar o dado abaixo: ```html no-beautify
- ...Text... + ...Texto...
``` -It has the border, padding and scrolling. The full set of features. There are no margins, as they are not the part of the element itself, and there are no special properties for them. +Ele tem a borda, o preenchimento (padding) e a rolagem. O conjunto completo de características. Não há margens, pois elas não são parte do elemento em si, e não há propriedades especiais para elas. -The element looks like this: +O elemento fica assim: ![](metric-css.svg) -You can [open the document in the sandbox](sandbox:metric). +Você pode [abrir o documento no sandbox](sandbox:metric). -```smart header="Mind the scrollbar" -The picture above demonstrates the most complex case when the element has a scrollbar. Some browsers (not all) reserve the space for it by taking it from the content (labeled as "content width" above). +```smart header="Atenção à barra de rolagem" +A imagem acima demonstra o caso mais complexo, quando o elemento tem uma barra de rolagem. Alguns navegadores (não todos) reservam espaço para ela, tirando-o do conteúdo (identificado como "largura do conteúdo" acima). -So, without scrollbar the content width would be `300px`, but if the scrollbar is `16px` wide (the width may vary between devices and browsers) then only `300 - 16 = 284px` remains, and we should take it into account. That's why examples from this chapter assume that there's a scrollbar. Without it, some calculations are simpler. +Então, sem a barra de rolagem a largura do conteúdo seria `300px`, mas se a barra de rolagem tiver `16px` de largura (a largura pode variar entre dispositivos e navegadores) então sobram apenas `300 - 16 = 284px`, e devemos levar isso em conta. É por isso que os exemplos deste capítulo assumem que há uma barra de rolagem. Sem ela, alguns cálculos são mais simples. ``` -```smart header="The `padding-bottom` area may be filled with text" -Usually paddings are shown empty on our illustrations, but if there's a lot of text in the element and it overflows, then browsers show the "overflowing" text at `padding-bottom`, that's normal. +```smart header="A área do `padding-bottom` pode ficar preenchida com texto" +Normalmente os preenchimentos (paddings) são mostrados vazios em nossas ilustrações, mas se houver muito texto no elemento e ele ultrapassar o limite, os navegadores mostram o texto "excedente" no `padding-bottom`, isso é normal. ``` -## Geometry +## Geometria -Here's the overall picture with geometry properties: +Aqui está a imagem geral com as propriedades de geometria: ![](metric-all.svg) -Values of these properties are technically numbers, but these numbers are "of pixels", so these are pixel measurements. +Os valores dessas propriedades são tecnicamente números, mas esses números são "em pixels", então são medidas em pixels. -Let's start exploring the properties starting from the outside of the element. +Vamos começar explorando as propriedades a partir de fora do elemento. ## offsetParent, offsetLeft/Top -These properties are rarely needed, but still they are the "most outer" geometry properties, so we'll start with them. +Essas propriedades raramente são necessárias, mas ainda assim são as propriedades de geometria "mais externas", então vamos começar com elas. -The `offsetParent` is the nearest ancestor that the browser uses for calculating coordinates during rendering. +O `offsetParent` é o ancestral mais próximo que o navegador usa para calcular coordenadas durante a renderização. -That's the nearest ancestor that is one of the following: +Esse é o ancestral mais próximo que seja um dos seguintes: -1. CSS-positioned (`position` is `absolute`, `relative`, `fixed` or `sticky`), or -2. ``, ``, or ``, or +1. Posicionado via CSS (`position` é `absolute`, `relative`, `fixed` ou `sticky`), ou +2. `
`, ``, ou ``, ou 3. ``. -Properties `offsetLeft/offsetTop` provide x/y coordinates relative to `offsetParent` upper-left corner. +As propriedades `offsetLeft/offsetTop` fornecem as coordenadas x/y relativas ao canto superior-esquerdo do `offsetParent`. -In the example below the inner `
` has `
` as `offsetParent` and `offsetLeft/offsetTop` shifts from its upper-left corner (`180`): +No exemplo abaixo, o `
` interno tem `
` como `offsetParent`, e `offsetLeft/offsetTop` são os deslocamentos a partir do seu canto superior-esquerdo (`180`): ```html run height=10
@@ -75,40 +75,40 @@ In the example below the inner `
` has `
` as `offsetParent` and `offse
``` ![](metric-offset-parent.svg) -There are several occasions when `offsetParent` is `null`: +Existem várias ocasiões em que `offsetParent` é `null`: -1. For not shown elements (`display:none` or not in the document). -2. For `` and ``. -3. For elements with `position:fixed`. +1. Para elementos não exibidos (`display:none` ou não no documento). +2. Para `` e ``. +3. Para elementos com `position:fixed`. ## offsetWidth/Height -Now let's move on to the element itself. +Agora vamos passar ao elemento em si. -These two properties are the simplest ones. They provide the "outer" width/height of the element. Or, in other words, its full size including borders. +Essas duas propriedades são as mais simples. Elas fornecem a largura/altura "externa" do elemento. Ou, em outras palavras, seu tamanho completo incluindo as bordas. ![](metric-offset-width-height.svg) -For our sample element: +Para nosso elemento de exemplo: -- `offsetWidth = 390` -- the outer width, can be calculated as inner CSS-width (`300px`) plus paddings (`2 * 20px`) and borders (`2 * 25px`). -- `offsetHeight = 290` -- the outer height. +- `offsetWidth = 390` -- a largura externa, pode ser calculada como a largura CSS interna (`300px`) mais os preenchimentos (`2 * 20px`) e as bordas (`2 * 25px`). +- `offsetHeight = 290` -- a altura externa. -````smart header="Geometry properties are zero/null for elements that are not displayed" -Geometry properties are calculated only for displayed elements. +````smart header="As propriedades de geometria são zero/null para elementos que não são exibidos" +As propriedades de geometria são calculadas apenas para elementos exibidos. -If an element (or any of its ancestors) has `display:none` or is not in the document, then all geometry properties are zero (or `null` for `offsetParent`). +Se um elemento (ou qualquer um de seus ancestrais) tiver `display:none` ou não estiver no documento, então todas as propriedades de geometria serão zero (ou `null` para `offsetParent`). -For example, `offsetParent` is `null`, and `offsetWidth`, `offsetHeight` are `0` when we created an element, but haven't inserted it into the document yet, or it (or its ancestor) has `display:none`. +Por exemplo, `offsetParent` é `null`, e `offsetWidth`, `offsetHeight` são `0` quando criamos um elemento, mas ainda não o inserimos no documento, ou ele (ou seu ancestral) tem `display:none`. -We can use this to check if an element is hidden, like this: +Podemos usar isso para verificar se um elemento está oculto, assim: ```js function isHidden(elem) { @@ -116,76 +116,76 @@ function isHidden(elem) { } ``` -Please note that such `isHidden` returns `true` for elements that are on-screen, but have zero sizes. +Note que esse `isHidden` retorna `true` para elementos que estão visíveis na tela, mas têm tamanhos zero. ```` ## clientTop/Left -Inside the element we have the borders. +Dentro do elemento temos as bordas. -To measure them, there are properties `clientTop` and `clientLeft`. +Para medi-las, existem as propriedades `clientTop` e `clientLeft`. -In our example: +No nosso exemplo: -- `clientLeft = 25` -- left border width -- `clientTop = 25` -- top border width +- `clientLeft = 25` -- largura da borda esquerda +- `clientTop = 25` -- largura da borda superior ![](metric-client-left-top.svg) -...But to be precise -- these properties are not border width/height, but rather relative coordinates of the inner side from the outer side. +...Mas, para ser preciso -- essas propriedades não são a largura/altura da borda, mas sim as coordenadas relativas do lado interno em relação ao lado externo. -What's the difference? +Qual é a diferença? -It becomes visible when the document is right-to-left (the operating system is in Arabic or Hebrew languages). The scrollbar is then not on the right, but on the left, and then `clientLeft` also includes the scrollbar width. +Ela se torna visível quando o documento é da direita para a esquerda (o sistema operacional está em árabe ou hebraico). A barra de rolagem fica então não à direita, mas à esquerda, e então `clientLeft` também inclui a largura da barra de rolagem. -In that case, `clientLeft` would be not `25`, but with the scrollbar width `25 + 16 = 41`. +Nesse caso, `clientLeft` não seria `25`, mas com a largura da barra de rolagem `25 + 16 = 41`. -Here's the example in hebrew: +Aqui está o exemplo em hebraico: ![](metric-client-left-top-rtl.svg) ## clientWidth/Height -These properties provide the size of the area inside the element borders. +Essas propriedades fornecem o tamanho da área dentro das bordas do elemento. -They include the content width together with paddings, but without the scrollbar: +Elas incluem a largura do conteúdo junto com os preenchimentos, mas sem a barra de rolagem: ![](metric-client-width-height.svg) -On the picture above let's first consider `clientHeight`. +Na imagem acima, vamos primeiro considerar o `clientHeight`. -There's no horizontal scrollbar, so it's exactly the sum of what's inside the borders: CSS-height `200px` plus top and bottom paddings (`2 * 20px`) total `240px`. +Não há barra de rolagem horizontal, então é exatamente a soma do que está dentro das bordas: a altura CSS `200px` mais os preenchimentos superior e inferior (`2 * 20px`), totalizando `240px`. -Now `clientWidth` -- here the content width is not `300px`, but `284px`, because `16px` are occupied by the scrollbar. So the sum is `284px` plus left and right paddings, total `324px`. +Agora `clientWidth` -- aqui a largura do conteúdo não é `300px`, mas `284px`, porque `16px` são ocupados pela barra de rolagem. Então a soma é `284px` mais os preenchimentos esquerdo e direito, totalizando `324px`. -**If there are no paddings, then `clientWidth/Height` is exactly the content area, inside the borders and the scrollbar (if any).** +**Se não há preenchimentos, então `clientWidth/Height` é exatamente a área de conteúdo, dentro das bordas e da barra de rolagem (se houver).** ![](metric-client-width-nopadding.svg) -So when there's no padding we can use `clientWidth/clientHeight` to get the content area size. +Então, quando não há preenchimento, podemos usar `clientWidth/clientHeight` para obter o tamanho da área de conteúdo. ## scrollWidth/Height -These properties are like `clientWidth/clientHeight`, but they also include the scrolled out (hidden) parts: +Essas propriedades são como `clientWidth/clientHeight`, mas também incluem as partes roladas para fora (ocultas): ![](metric-scroll-width-height.svg) -On the picture above: +Na imagem acima: -- `scrollHeight = 723` -- is the full inner height of the content area including the scrolled out parts. -- `scrollWidth = 324` -- is the full inner width, here we have no horizontal scroll, so it equals `clientWidth`. +- `scrollHeight = 723` -- é a altura interna completa da área de conteúdo, incluindo as partes roladas para fora. +- `scrollWidth = 324` -- é a largura interna completa, aqui não temos rolagem horizontal, então é igual a `clientWidth`. -We can use these properties to expand the element wide to its full width/height. +Podemos usar essas propriedades para expandir o elemento até sua largura/altura total. -Like this: +Assim: ```js -// expand the element to the full content height +// expande o elemento até a altura completa do conteúdo element.style.height = `${element.scrollHeight}px`; ``` ```online -Click the button to expand the element: +Clique no botão para expandir o elemento:
text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text
@@ -194,47 +194,47 @@ Click the button to expand the element: ## scrollLeft/scrollTop -Properties `scrollLeft/scrollTop` are the width/height of the hidden, scrolled out part of the element. +As propriedades `scrollLeft/scrollTop` são a largura/altura da parte oculta e rolada para fora do elemento. -On the picture below we can see `scrollHeight` and `scrollTop` for a block with a vertical scroll. +Na imagem abaixo podemos ver `scrollHeight` e `scrollTop` para um bloco com rolagem vertical. ![](metric-scroll-top.svg) -In other words, `scrollTop` is "how much is scrolled up". +Em outras palavras, `scrollTop` é "quanto foi rolado para cima". -````smart header="`scrollLeft/scrollTop` can be modified" -Most of the geometry properties here are read-only, but `scrollLeft/scrollTop` can be changed, and the browser will scroll the element. +````smart header="`scrollLeft/scrollTop` podem ser modificados" +A maioria das propriedades de geometria aqui são apenas leitura, mas `scrollLeft/scrollTop` podem ser alteradas, e o navegador vai rolar o elemento. ```online -If you click the element below, the code `elem.scrollTop += 10` executes. That makes the element content scroll `10px` down. +Se você clicar no elemento abaixo, o código `elem.scrollTop += 10` é executado. Isso faz o conteúdo do elemento rolar `10px` para baixo. -
Click
Me
1
2
3
4
5
6
7
8
9
+
Clique
Em
Mim
1
2
3
4
5
6
7
8
9
``` -Setting `scrollTop` to `0` or a big value, such as `1e9` will make the element scroll to the very top/bottom respectively. +Definir `scrollTop` como `0` ou um valor grande, como `1e9`, fará o elemento rolar até o topo/fundo, respectivamente. ```` -## Don't take width/height from CSS +## Não obtenha width/height a partir do CSS -We've just covered geometry properties of DOM elements, that can be used to get widths, heights and calculate distances. +Acabamos de abordar as propriedades de geometria dos elementos do DOM, que podem ser usadas para obter larguras, alturas e calcular distâncias. -But as we know from the chapter , we can read CSS-height and width using `getComputedStyle`. +Mas, como sabemos pelo capítulo , podemos ler a altura e a largura CSS usando `getComputedStyle`. -So why not to read the width of an element with `getComputedStyle`, like this? +Então por que não ler a largura de um elemento com `getComputedStyle`, assim? ```js run let elem = document.body; -alert( getComputedStyle(elem).width ); // show CSS width for elem +alert( getComputedStyle(elem).width ); // mostra a largura CSS de elem ``` -Why should we use geometry properties instead? There are two reasons: +Por que deveríamos usar as propriedades de geometria em vez disso? Há duas razões: -1. First, CSS `width/height` depend on another property: `box-sizing` that defines "what is" CSS width and height. A change in `box-sizing` for CSS purposes may break such JavaScript. -2. Second, CSS `width/height` may be `auto`, for instance for an inline element: +1. Primeiro, `width/height` do CSS dependem de outra propriedade: `box-sizing`, que define "o que é" a largura e a altura CSS. Uma mudança em `box-sizing` para fins de CSS pode quebrar esse JavaScript. +2. Segundo, `width/height` do CSS podem ser `auto`, por exemplo para um elemento inline: ```html run - Hello! + Olá! ``` - From the CSS standpoint, `width:auto` is perfectly normal, but in JavaScript we need an exact size in `px` that we can use in calculations. So here CSS width is useless. + Do ponto de vista do CSS, `width:auto` é perfeitamente normal, mas em JavaScript precisamos de um tamanho exato em `px` que possamos usar em cálculos. Então aqui a largura CSS é inútil. -And there's one more reason: a scrollbar. Sometimes the code that works fine without a scrollbar becomes buggy with it, because a scrollbar takes the space from the content in some browsers. So the real width available for the content is *less* than CSS width. And `clientWidth/clientHeight` take that into account. +E há mais uma razão: a barra de rolagem. Às vezes, um código que funciona bem sem uma barra de rolagem fica com bugs quando ela aparece, porque a barra de rolagem toma espaço do conteúdo em alguns navegadores. Então a largura real disponível para o conteúdo é *menor* que a largura CSS. E `clientWidth/clientHeight` levam isso em conta. -...But with `getComputedStyle(elem).width` the situation is different. Some browsers (e.g. Chrome) return the real inner width, minus the scrollbar, and some of them (e.g. Firefox) -- CSS width (ignore the scrollbar). Such cross-browser differences is the reason not to use `getComputedStyle`, but rather rely on geometry properties. +...Mas com `getComputedStyle(elem).width` a situação é diferente. Alguns navegadores (por exemplo, Chrome) retornam a largura interna real, menos a barra de rolagem, e alguns deles (por exemplo, Firefox) -- a largura CSS (ignorando a barra de rolagem). Essas diferenças entre navegadores são a razão para não usar `getComputedStyle`, mas sim confiar nas propriedades de geometria. ```online -If your browser reserves the space for a scrollbar (most browsers for Windows do), then you can test it below. +Se seu navegador reserva o espaço para uma barra de rolagem (a maioria dos navegadores para Windows faz isso), então você pode testar abaixo. [iframe src="cssWidthScroll" link border=1] -The element with text has CSS `width:300px`. +O elemento com texto tem `width:300px` no CSS. -On a Desktop Windows OS, Firefox, Chrome, Edge all reserve the space for the scrollbar. But Firefox shows `300px`, while Chrome and Edge show less. That's because Firefox returns the CSS width and other browsers return the "real" width. +Em um Desktop com Windows, Firefox, Chrome e Edge todos reservam o espaço para a barra de rolagem. Mas o Firefox mostra `300px`, enquanto Chrome e Edge mostram menos. Isso ocorre porque o Firefox retorna a largura CSS e os outros navegadores retornam a largura "real". ``` -Please note that the described difference is only about reading `getComputedStyle(...).width` from JavaScript, visually everything is correct. +Note que a diferença descrita é apenas sobre ler `getComputedStyle(...).width` a partir do JavaScript, visualmente tudo está correto. -## Summary +## Resumo -Elements have the following geometry properties: +Os elementos têm as seguintes propriedades de geometria: -- `offsetParent` -- is the nearest positioned ancestor or `td`, `th`, `table`, `body`. -- `offsetLeft/offsetTop` -- coordinates relative to the upper-left edge of `offsetParent`. -- `offsetWidth/offsetHeight` -- "outer" width/height of an element including borders. -- `clientLeft/clientTop` -- the distances from the upper-left outer corner to the upper-left inner (content + padding) corner. For left-to-right OS they are always the widths of left/top borders. For right-to-left OS the vertical scrollbar is on the left so `clientLeft` includes its width too. -- `clientWidth/clientHeight` -- the width/height of the content including paddings, but without the scrollbar. -- `scrollWidth/scrollHeight` -- the width/height of the content, just like `clientWidth/clientHeight`, but also include scrolled-out, invisible part of the element. -- `scrollLeft/scrollTop` -- width/height of the scrolled out upper part of the element, starting from its upper-left corner. +- `offsetParent` -- é o ancestral posicionado mais próximo, ou `td`, `th`, `table`, `body`. +- `offsetLeft/offsetTop` -- coordenadas relativas à borda superior-esquerda do `offsetParent`. +- `offsetWidth/offsetHeight` -- largura/altura "externa" de um elemento, incluindo as bordas. +- `clientLeft/clientTop` -- as distâncias do canto externo superior-esquerdo até o canto interno (conteúdo + preenchimento) superior-esquerdo. Para sistemas operacionais da esquerda para a direita, elas são sempre as larguras das bordas esquerda/superior. Para sistemas operacionais da direita para a esquerda, a barra de rolagem vertical fica à esquerda, então `clientLeft` também inclui sua largura. +- `clientWidth/clientHeight` -- a largura/altura do conteúdo incluindo os preenchimentos, mas sem a barra de rolagem. +- `scrollWidth/scrollHeight` -- a largura/altura do conteúdo, assim como `clientWidth/clientHeight`, mas também incluem a parte rolada para fora, invisível, do elemento. +- `scrollLeft/scrollTop` -- largura/altura da parte superior rolada para fora do elemento, a partir do seu canto superior-esquerdo. -All properties are read-only except `scrollLeft/scrollTop` that make the browser scroll the element if changed. +Todas as propriedades são apenas leitura, exceto `scrollLeft/scrollTop`, que fazem o navegador rolar o elemento se forem alteradas. diff --git a/2-ui/1-document/09-size-and-scroll/cssWidthScroll.view/index.html b/2-ui/1-document/09-size-and-scroll/cssWidthScroll.view/index.html index 2869c7ed9..c799c3122 100755 --- a/2-ui/1-document/09-size-and-scroll/cssWidthScroll.view/index.html +++ b/2-ui/1-document/09-size-and-scroll/cssWidthScroll.view/index.html @@ -7,7 +7,7 @@ text text text text text text text text text text text text text text text text text text text text text text text text text text
- The element has style="width:300px" + O elemento tem style="width:300px"
diff --git a/2-ui/1-document/09-size-and-scroll/metric-client-left-top-rtl.svg b/2-ui/1-document/09-size-and-scroll/metric-client-left-top-rtl.svg index e8dd3d60a..9b3b638cf 100644 --- a/2-ui/1-document/09-size-and-scroll/metric-client-left-top-rtl.svg +++ b/2-ui/1-document/09-size-and-scroll/metric-client-left-top-rtl.svg @@ -1 +1 @@ -clientTop: 25px = borderclientLeft: 41px \ No newline at end of file +clientTop: 25px = bordaclientLeft: 41px \ No newline at end of file diff --git a/2-ui/1-document/09-size-and-scroll/metric-client-left-top.svg b/2-ui/1-document/09-size-and-scroll/metric-client-left-top.svg index 8097afa78..35a22c44c 100644 --- a/2-ui/1-document/09-size-and-scroll/metric-client-left-top.svg +++ b/2-ui/1-document/09-size-and-scroll/metric-client-left-top.svg @@ -1 +1 @@ -Introduction This Ecma Standard is based on several originating technologies, the most well known being JavaScript (Netscape) and JScript (Microsoft). The language was invented by Brendan Eich at Netscape and first appeared in that company’s Navigator 2.0 browser. It has appeared in all subsequent browsers from Netscape and in all browsers from Microsoft starting with Internet Explorer 3.0. The development of this Standard started in November 1996. The first edition of this Ecma Standard was adopted by the Ecma General Assembly of June 1997.clientTop: 25px = borderclientLeft: 25px \ No newline at end of file +Introduction This Ecma Standard is based on several originating technologies, the most well known being JavaScript (Netscape) and JScript (Microsoft). The language was invented by Brendan Eich at Netscape and first appeared in that company’s Navigator 2.0 browser. It has appeared in all subsequent browsers from Netscape and in all browsers from Microsoft starting with Internet Explorer 3.0. The development of this Standard started in November 1996. The first edition of this Ecma Standard was adopted by the Ecma General Assembly of June 1997.clientTop: 25px = bordaclientLeft: 25px \ No newline at end of file diff --git a/2-ui/1-document/09-size-and-scroll/metric-client-width-height.svg b/2-ui/1-document/09-size-and-scroll/metric-client-width-height.svg index 2603b05fb..f0757a6c2 100644 --- a/2-ui/1-document/09-size-and-scroll/metric-client-width-height.svg +++ b/2-ui/1-document/09-size-and-scroll/metric-client-width-height.svg @@ -1 +1 @@ -border 25pxpadding 20pxcontent width: 284pxborder 25pxpadding 20pxscrollbar 16pxclientWidth = 20+284+20 = 324pxclientHeight: 240pxheight: 200pxIntroduction This Ecma Standard is based on several originating technologies, the most well known being JavaScript (Netscape) and JScript (Microsoft). The language was invented by Brendan Eich at Netscape and first appeared in that company’s Navigator 2.0 browser. It has appeared in all subsequent browsers from Netscape and in all browsers from Microsoft starting with \ No newline at end of file +borda 25pxpreenchimento 20pxlargura do conteúdo: 284pxborda 25pxpreenchimento 20pxbarra de rolagem 16pxclientWidth = 20+284+20 = 324pxclientHeight: 240pxaltura: 200pxIntroduction This Ecma Standard is based on several originating technologies, the most well known being JavaScript (Netscape) and JScript (Microsoft). The language was invented by Brendan Eich at Netscape and first appeared in that company’s Navigator 2.0 browser. It has appeared in all subsequent browsers from Netscape and in all browsers from Microsoft starting with \ No newline at end of file diff --git a/2-ui/1-document/09-size-and-scroll/metric-client-width-nopadding.svg b/2-ui/1-document/09-size-and-scroll/metric-client-width-nopadding.svg index 330d2a7c0..53b23f195 100644 --- a/2-ui/1-document/09-size-and-scroll/metric-client-width-nopadding.svg +++ b/2-ui/1-document/09-size-and-scroll/metric-client-width-nopadding.svg @@ -1 +1 @@ -clientWidth: 284px = content widthCSS width: 300pxIntroduction This Ecma Standard is based on several originating technologies, the most well known being JavaScript (Netscape) and JScript (Microsoft). The language was invented by Brendan Eich at Netscape and first appeared in that company’s Navigator 2.0 browser. It has appeared in all subsequent browsers from Netscape and in all browsers from Microsoft starting with padding: 0; width: 300px; \ No newline at end of file +clientWidth: 284px = largura do conteúdolargura CSS: 300pxIntroduction This Ecma Standard is based on several originating technologies, the most well known being JavaScript (Netscape) and JScript (Microsoft). The language was invented by Brendan Eich at Netscape and first appeared in that company’s Navigator 2.0 browser. It has appeared in all subsequent browsers from Netscape and in all browsers from Microsoft starting with padding: 0; width: 300px; \ No newline at end of file diff --git a/2-ui/1-document/09-size-and-scroll/metric-css.svg b/2-ui/1-document/09-size-and-scroll/metric-css.svg index 1f2e5f780..4a613ab77 100644 --- a/2-ui/1-document/09-size-and-scroll/metric-css.svg +++ b/2-ui/1-document/09-size-and-scroll/metric-css.svg @@ -1 +1 @@ -padding: 20pxheight: 200pxpadding: 20pxborder 25pxpadding 20pxcontent width: 284pxborder 25pxpadding 20pxscrollbar 16pxIntroduction This Ecma Standard is based on several originating technologies, the most well known being JavaScript (Netscape) and JScript (Microsoft). The language was invented by Brendan Eich at Netscape and first appeared in that company’s Navigator 2.0 browser. It has appeared in all subsequent browsers from Netscape and in all browsers from Microsoft starting with \ No newline at end of file +preenchimento: 20pxaltura: 200pxpreenchimento: 20pxborda 25pxpreenchimento 20pxlargura do conteúdo: 284pxborda 25pxpreenchimento 20pxbarra de rolagem 16pxIntroduction This Ecma Standard is based on several originating technologies, the most well known being JavaScript (Netscape) and JScript (Microsoft). The language was invented by Brendan Eich at Netscape and first appeared in that company’s Navigator 2.0 browser. It has appeared in all subsequent browsers from Netscape and in all browsers from Microsoft starting with \ No newline at end of file diff --git a/2-ui/1-document/09-size-and-scroll/metric-offset-width-height.svg b/2-ui/1-document/09-size-and-scroll/metric-offset-width-height.svg index 4d30d90cc..5fcc3e0bd 100644 --- a/2-ui/1-document/09-size-and-scroll/metric-offset-width-height.svg +++ b/2-ui/1-document/09-size-and-scroll/metric-offset-width-height.svg @@ -1 +1 @@ -border 25pxpadding 20pxcontent width: 284pxheight: 200pxborder 25pxpadding 20pxscrollbar 16pxoffsetWidth = 25+20+284+20+16+25 = 390pxoffsetHeight: 290pxIntroduction This Ecma Standard is based on several originating technologies, the most well known being JavaScript (Netscape) and JScript (Microsoft). The language was invented by Brendan Eich at Netscape and first appeared in that company’s Navigator 2.0 browser. It has appeared in all subsequent browsers from Netscape and in all browsers from Microsoft starting with \ No newline at end of file +borda 25pxpreenchimento 20pxlargura do conteúdo: 284pxaltura: 200pxborda 25pxpreenchimento 20pxbarra de rolagem 16pxoffsetWidth = 25+20+284+20+16+25 = 390pxoffsetHeight: 290pxIntroduction This Ecma Standard is based on several originating technologies, the most well known being JavaScript (Netscape) and JScript (Microsoft). The language was invented by Brendan Eich at Netscape and first appeared in that company’s Navigator 2.0 browser. It has appeared in all subsequent browsers from Netscape and in all browsers from Microsoft starting with \ No newline at end of file diff --git a/2-ui/1-document/09-size-and-scroll/metric.view/index.html b/2-ui/1-document/09-size-and-scroll/metric.view/index.html index 4ac208164..b2a0bfa4a 100755 --- a/2-ui/1-document/09-size-and-scroll/metric.view/index.html +++ b/2-ui/1-document/09-size-and-scroll/metric.view/index.html @@ -43,7 +43,7 @@

Introduction

-
Mouse coordinates: ...
+
Coordenadas do mouse: ...
@@ -54,7 +54,7 @@

Introduction

offsetParent: ['offsetParent', 'offsetLeft', 'offsetTop'] }; - info.innerHTML = '

Click to see the value:

'; + info.innerHTML = '

Clique para ver o valor:

'; for (let k in props) { info.innerHTML += `

${k}

`; let prop = props[k]; diff --git a/images.yml b/images.yml index b8cee36ab..c4ed4cfd4 100644 --- a/images.yml +++ b/images.yml @@ -95,3 +95,69 @@ array-shift.svg: "to the left": text: "para a esquerda" position: left +metric-client-left-top-rtl.svg: + "= border": + text: "= borda" + position: left +metric-client-left-top.svg: + " = border": + text: " = borda" + position: left +metric-client-width-height.svg: + "border": + text: "borda" + position: left + "padding": + text: "preenchimento" + position: left + "content width:": + text: "largura do conteúdo:" + position: left + "scrollbar": + text: "barra de rolagem" + position: left + "height:": + text: "altura:" + position: left +metric-client-width-nopadding.svg: + "= content width": + text: "= largura do conteúdo" + position: left + "CSS width:": + text: "largura CSS:" + position: left +metric-css.svg: + "padding:": + text: "preenchimento:" + position: left + "height:": + text: "altura:" + position: left + "border": + text: "borda" + position: left + "padding": + text: "preenchimento" + position: left + "content width:": + text: "largura do conteúdo:" + position: left + "scrollbar": + text: "barra de rolagem" + position: left +metric-offset-width-height.svg: + "border": + text: "borda" + position: left + "padding": + text: "preenchimento" + position: left + "content width:": + text: "largura do conteúdo:" + position: left + "height:": + text: "altura:" + position: left + "scrollbar": + text: "barra de rolagem" + position: left From b510f73782c36bbd53c21de4d8f8f0ab216eb6be Mon Sep 17 00:00:00 2001 From: Diogo Marciano Date: Sat, 21 Nov 2026 23:16:08 -0300 Subject: [PATCH 2/3] Fix overlapping SVG labels flagged by gabifs MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Translated labels longer than the English originals overlapped the adjacent values, which stay at their original fixed x position: - "content width:" -> shortened to "conteúdo:" (metric-css.svg, metric-client-width-height.svg, metric-offset-width-height.svg) - "padding:" and "scrollbar" left untranslated in metric-css.svg, where the longer PT text ran into the "20px" value or past the image's right edge - "CSS width:" -> "larg. CSS:", matching the original's length Regenerated via the images.yml pipeline and verified the resulting tspan positions no longer collide. Co-Authored-By: Claude Sonnet 5 --- .../metric-client-width-height.svg | 2 +- .../metric-client-width-nopadding.svg | 2 +- 2-ui/1-document/09-size-and-scroll/metric-css.svg | 2 +- .../metric-offset-width-height.svg | 2 +- images.yml | 12 ++++++------ 5 files changed, 10 insertions(+), 10 deletions(-) diff --git a/2-ui/1-document/09-size-and-scroll/metric-client-width-height.svg b/2-ui/1-document/09-size-and-scroll/metric-client-width-height.svg index f0757a6c2..1e18cc1b5 100644 --- a/2-ui/1-document/09-size-and-scroll/metric-client-width-height.svg +++ b/2-ui/1-document/09-size-and-scroll/metric-client-width-height.svg @@ -1 +1 @@ -borda 25pxpreenchimento 20pxlargura do conteúdo: 284pxborda 25pxpreenchimento 20pxbarra de rolagem 16pxclientWidth = 20+284+20 = 324pxclientHeight: 240pxaltura: 200pxIntroduction This Ecma Standard is based on several originating technologies, the most well known being JavaScript (Netscape) and JScript (Microsoft). The language was invented by Brendan Eich at Netscape and first appeared in that company’s Navigator 2.0 browser. It has appeared in all subsequent browsers from Netscape and in all browsers from Microsoft starting with \ No newline at end of file +borda 25pxpreenchimento 20pxconteúdo: 284pxborda 25pxpreenchimento 20pxbarra de rolagem 16pxclientWidth = 20+284+20 = 324pxclientHeight: 240pxaltura: 200pxIntroduction This Ecma Standard is based on several originating technologies, the most well known being JavaScript (Netscape) and JScript (Microsoft). The language was invented by Brendan Eich at Netscape and first appeared in that company’s Navigator 2.0 browser. It has appeared in all subsequent browsers from Netscape and in all browsers from Microsoft starting with \ No newline at end of file diff --git a/2-ui/1-document/09-size-and-scroll/metric-client-width-nopadding.svg b/2-ui/1-document/09-size-and-scroll/metric-client-width-nopadding.svg index 53b23f195..f0fcc3290 100644 --- a/2-ui/1-document/09-size-and-scroll/metric-client-width-nopadding.svg +++ b/2-ui/1-document/09-size-and-scroll/metric-client-width-nopadding.svg @@ -1 +1 @@ -clientWidth: 284px = largura do conteúdolargura CSS: 300pxIntroduction This Ecma Standard is based on several originating technologies, the most well known being JavaScript (Netscape) and JScript (Microsoft). The language was invented by Brendan Eich at Netscape and first appeared in that company’s Navigator 2.0 browser. It has appeared in all subsequent browsers from Netscape and in all browsers from Microsoft starting with padding: 0; width: 300px; \ No newline at end of file +clientWidth: 284px = largura do conteúdolarg. CSS: 300pxIntroduction This Ecma Standard is based on several originating technologies, the most well known being JavaScript (Netscape) and JScript (Microsoft). The language was invented by Brendan Eich at Netscape and first appeared in that company’s Navigator 2.0 browser. It has appeared in all subsequent browsers from Netscape and in all browsers from Microsoft starting with padding: 0; width: 300px; \ No newline at end of file diff --git a/2-ui/1-document/09-size-and-scroll/metric-css.svg b/2-ui/1-document/09-size-and-scroll/metric-css.svg index 4a613ab77..82e3dcf1a 100644 --- a/2-ui/1-document/09-size-and-scroll/metric-css.svg +++ b/2-ui/1-document/09-size-and-scroll/metric-css.svg @@ -1 +1 @@ -preenchimento: 20pxaltura: 200pxpreenchimento: 20pxborda 25pxpreenchimento 20pxlargura do conteúdo: 284pxborda 25pxpreenchimento 20pxbarra de rolagem 16pxIntroduction This Ecma Standard is based on several originating technologies, the most well known being JavaScript (Netscape) and JScript (Microsoft). The language was invented by Brendan Eich at Netscape and first appeared in that company’s Navigator 2.0 browser. It has appeared in all subsequent browsers from Netscape and in all browsers from Microsoft starting with \ No newline at end of file +padding: 20pxaltura: 200pxpadding: 20pxborda 25pxpreenchimento 20pxconteúdo: 284pxborda 25pxpreenchimento 20pxscrollbar 16pxIntroduction This Ecma Standard is based on several originating technologies, the most well known being JavaScript (Netscape) and JScript (Microsoft). The language was invented by Brendan Eich at Netscape and first appeared in that company’s Navigator 2.0 browser. It has appeared in all subsequent browsers from Netscape and in all browsers from Microsoft starting with \ No newline at end of file diff --git a/2-ui/1-document/09-size-and-scroll/metric-offset-width-height.svg b/2-ui/1-document/09-size-and-scroll/metric-offset-width-height.svg index 5fcc3e0bd..9b0462e04 100644 --- a/2-ui/1-document/09-size-and-scroll/metric-offset-width-height.svg +++ b/2-ui/1-document/09-size-and-scroll/metric-offset-width-height.svg @@ -1 +1 @@ -borda 25pxpreenchimento 20pxlargura do conteúdo: 284pxaltura: 200pxborda 25pxpreenchimento 20pxbarra de rolagem 16pxoffsetWidth = 25+20+284+20+16+25 = 390pxoffsetHeight: 290pxIntroduction This Ecma Standard is based on several originating technologies, the most well known being JavaScript (Netscape) and JScript (Microsoft). The language was invented by Brendan Eich at Netscape and first appeared in that company’s Navigator 2.0 browser. It has appeared in all subsequent browsers from Netscape and in all browsers from Microsoft starting with \ No newline at end of file +borda 25pxpreenchimento 20pxconteúdo: 284pxaltura: 200pxborda 25pxpreenchimento 20pxbarra de rolagem 16pxoffsetWidth = 25+20+284+20+16+25 = 390pxoffsetHeight: 290pxIntroduction This Ecma Standard is based on several originating technologies, the most well known being JavaScript (Netscape) and JScript (Microsoft). The language was invented by Brendan Eich at Netscape and first appeared in that company’s Navigator 2.0 browser. It has appeared in all subsequent browsers from Netscape and in all browsers from Microsoft starting with \ No newline at end of file diff --git a/images.yml b/images.yml index c4ed4cfd4..9eefca494 100644 --- a/images.yml +++ b/images.yml @@ -111,7 +111,7 @@ metric-client-width-height.svg: text: "preenchimento" position: left "content width:": - text: "largura do conteúdo:" + text: "conteúdo:" position: left "scrollbar": text: "barra de rolagem" @@ -124,11 +124,11 @@ metric-client-width-nopadding.svg: text: "= largura do conteúdo" position: left "CSS width:": - text: "largura CSS:" + text: "larg. CSS:" position: left metric-css.svg: "padding:": - text: "preenchimento:" + text: "padding:" position: left "height:": text: "altura:" @@ -140,10 +140,10 @@ metric-css.svg: text: "preenchimento" position: left "content width:": - text: "largura do conteúdo:" + text: "conteúdo:" position: left "scrollbar": - text: "barra de rolagem" + text: "scrollbar" position: left metric-offset-width-height.svg: "border": @@ -153,7 +153,7 @@ metric-offset-width-height.svg: text: "preenchimento" position: left "content width:": - text: "largura do conteúdo:" + text: "conteúdo:" position: left "height:": text: "altura:" From c0666e49c5e6c82dbc022f114bd380f3551024eb Mon Sep 17 00:00:00 2001 From: Diogo Marciano Date: Sun, 22 Nov 2026 16:23:47 -0300 Subject: [PATCH 3/3] Restore all SVGs in this chapter to upstream English originals Per gabifs (on PR #505/#511, same rule applies here): SVG files in the repo always stay identical to the English upstream; translation is applied only from images.yml, never by committing a translated file, whether hand-edited or generated by the figuresTranslate pipeline. This includes two files (metric-client-left-top.svg, metric-client-left-top-rtl.svg) that had been committed translated since before this round of fixes. All images.yml entries, including the label-width fixes from the previous commit, stay as-is. Co-Authored-By: Claude Sonnet 5 --- .../09-size-and-scroll/metric-client-left-top-rtl.svg | 2 +- 2-ui/1-document/09-size-and-scroll/metric-client-left-top.svg | 2 +- .../09-size-and-scroll/metric-client-width-height.svg | 2 +- .../09-size-and-scroll/metric-client-width-nopadding.svg | 2 +- 2-ui/1-document/09-size-and-scroll/metric-css.svg | 2 +- .../09-size-and-scroll/metric-offset-width-height.svg | 2 +- 6 files changed, 6 insertions(+), 6 deletions(-) diff --git a/2-ui/1-document/09-size-and-scroll/metric-client-left-top-rtl.svg b/2-ui/1-document/09-size-and-scroll/metric-client-left-top-rtl.svg index 9b3b638cf..e8dd3d60a 100644 --- a/2-ui/1-document/09-size-and-scroll/metric-client-left-top-rtl.svg +++ b/2-ui/1-document/09-size-and-scroll/metric-client-left-top-rtl.svg @@ -1 +1 @@ -clientTop: 25px = bordaclientLeft: 41px \ No newline at end of file +clientTop: 25px = borderclientLeft: 41px \ No newline at end of file diff --git a/2-ui/1-document/09-size-and-scroll/metric-client-left-top.svg b/2-ui/1-document/09-size-and-scroll/metric-client-left-top.svg index 35a22c44c..8097afa78 100644 --- a/2-ui/1-document/09-size-and-scroll/metric-client-left-top.svg +++ b/2-ui/1-document/09-size-and-scroll/metric-client-left-top.svg @@ -1 +1 @@ -Introduction This Ecma Standard is based on several originating technologies, the most well known being JavaScript (Netscape) and JScript (Microsoft). The language was invented by Brendan Eich at Netscape and first appeared in that company’s Navigator 2.0 browser. It has appeared in all subsequent browsers from Netscape and in all browsers from Microsoft starting with Internet Explorer 3.0. The development of this Standard started in November 1996. The first edition of this Ecma Standard was adopted by the Ecma General Assembly of June 1997.clientTop: 25px = bordaclientLeft: 25px \ No newline at end of file +Introduction This Ecma Standard is based on several originating technologies, the most well known being JavaScript (Netscape) and JScript (Microsoft). The language was invented by Brendan Eich at Netscape and first appeared in that company’s Navigator 2.0 browser. It has appeared in all subsequent browsers from Netscape and in all browsers from Microsoft starting with Internet Explorer 3.0. The development of this Standard started in November 1996. The first edition of this Ecma Standard was adopted by the Ecma General Assembly of June 1997.clientTop: 25px = borderclientLeft: 25px \ No newline at end of file diff --git a/2-ui/1-document/09-size-and-scroll/metric-client-width-height.svg b/2-ui/1-document/09-size-and-scroll/metric-client-width-height.svg index 1e18cc1b5..2603b05fb 100644 --- a/2-ui/1-document/09-size-and-scroll/metric-client-width-height.svg +++ b/2-ui/1-document/09-size-and-scroll/metric-client-width-height.svg @@ -1 +1 @@ -borda 25pxpreenchimento 20pxconteúdo: 284pxborda 25pxpreenchimento 20pxbarra de rolagem 16pxclientWidth = 20+284+20 = 324pxclientHeight: 240pxaltura: 200pxIntroduction This Ecma Standard is based on several originating technologies, the most well known being JavaScript (Netscape) and JScript (Microsoft). The language was invented by Brendan Eich at Netscape and first appeared in that company’s Navigator 2.0 browser. It has appeared in all subsequent browsers from Netscape and in all browsers from Microsoft starting with \ No newline at end of file +border 25pxpadding 20pxcontent width: 284pxborder 25pxpadding 20pxscrollbar 16pxclientWidth = 20+284+20 = 324pxclientHeight: 240pxheight: 200pxIntroduction This Ecma Standard is based on several originating technologies, the most well known being JavaScript (Netscape) and JScript (Microsoft). The language was invented by Brendan Eich at Netscape and first appeared in that company’s Navigator 2.0 browser. It has appeared in all subsequent browsers from Netscape and in all browsers from Microsoft starting with \ No newline at end of file diff --git a/2-ui/1-document/09-size-and-scroll/metric-client-width-nopadding.svg b/2-ui/1-document/09-size-and-scroll/metric-client-width-nopadding.svg index f0fcc3290..330d2a7c0 100644 --- a/2-ui/1-document/09-size-and-scroll/metric-client-width-nopadding.svg +++ b/2-ui/1-document/09-size-and-scroll/metric-client-width-nopadding.svg @@ -1 +1 @@ -clientWidth: 284px = largura do conteúdolarg. CSS: 300pxIntroduction This Ecma Standard is based on several originating technologies, the most well known being JavaScript (Netscape) and JScript (Microsoft). The language was invented by Brendan Eich at Netscape and first appeared in that company’s Navigator 2.0 browser. It has appeared in all subsequent browsers from Netscape and in all browsers from Microsoft starting with padding: 0; width: 300px; \ No newline at end of file +clientWidth: 284px = content widthCSS width: 300pxIntroduction This Ecma Standard is based on several originating technologies, the most well known being JavaScript (Netscape) and JScript (Microsoft). The language was invented by Brendan Eich at Netscape and first appeared in that company’s Navigator 2.0 browser. It has appeared in all subsequent browsers from Netscape and in all browsers from Microsoft starting with padding: 0; width: 300px; \ No newline at end of file diff --git a/2-ui/1-document/09-size-and-scroll/metric-css.svg b/2-ui/1-document/09-size-and-scroll/metric-css.svg index 82e3dcf1a..1f2e5f780 100644 --- a/2-ui/1-document/09-size-and-scroll/metric-css.svg +++ b/2-ui/1-document/09-size-and-scroll/metric-css.svg @@ -1 +1 @@ -padding: 20pxaltura: 200pxpadding: 20pxborda 25pxpreenchimento 20pxconteúdo: 284pxborda 25pxpreenchimento 20pxscrollbar 16pxIntroduction This Ecma Standard is based on several originating technologies, the most well known being JavaScript (Netscape) and JScript (Microsoft). The language was invented by Brendan Eich at Netscape and first appeared in that company’s Navigator 2.0 browser. It has appeared in all subsequent browsers from Netscape and in all browsers from Microsoft starting with \ No newline at end of file +padding: 20pxheight: 200pxpadding: 20pxborder 25pxpadding 20pxcontent width: 284pxborder 25pxpadding 20pxscrollbar 16pxIntroduction This Ecma Standard is based on several originating technologies, the most well known being JavaScript (Netscape) and JScript (Microsoft). The language was invented by Brendan Eich at Netscape and first appeared in that company’s Navigator 2.0 browser. It has appeared in all subsequent browsers from Netscape and in all browsers from Microsoft starting with \ No newline at end of file diff --git a/2-ui/1-document/09-size-and-scroll/metric-offset-width-height.svg b/2-ui/1-document/09-size-and-scroll/metric-offset-width-height.svg index 9b0462e04..4d30d90cc 100644 --- a/2-ui/1-document/09-size-and-scroll/metric-offset-width-height.svg +++ b/2-ui/1-document/09-size-and-scroll/metric-offset-width-height.svg @@ -1 +1 @@ -borda 25pxpreenchimento 20pxconteúdo: 284pxaltura: 200pxborda 25pxpreenchimento 20pxbarra de rolagem 16pxoffsetWidth = 25+20+284+20+16+25 = 390pxoffsetHeight: 290pxIntroduction This Ecma Standard is based on several originating technologies, the most well known being JavaScript (Netscape) and JScript (Microsoft). The language was invented by Brendan Eich at Netscape and first appeared in that company’s Navigator 2.0 browser. It has appeared in all subsequent browsers from Netscape and in all browsers from Microsoft starting with \ No newline at end of file +border 25pxpadding 20pxcontent width: 284pxheight: 200pxborder 25pxpadding 20pxscrollbar 16pxoffsetWidth = 25+20+284+20+16+25 = 390pxoffsetHeight: 290pxIntroduction This Ecma Standard is based on several originating technologies, the most well known being JavaScript (Netscape) and JScript (Microsoft). The language was invented by Brendan Eich at Netscape and first appeared in that company’s Navigator 2.0 browser. It has appeared in all subsequent browsers from Netscape and in all browsers from Microsoft starting with \ No newline at end of file