Skip to content

zoom CSS Property#33473

Merged
bsmth merged 7 commits intomdn:mainfrom
CodeRedDigital:32957-css-zoom
May 13, 2024
Merged

zoom CSS Property#33473
bsmth merged 7 commits intomdn:mainfrom
CodeRedDigital:32957-css-zoom

Conversation

@dletorey
Copy link
Copy Markdown
Contributor

@dletorey dletorey commented May 7, 2024

Description

Updated the examples of zoom CSS property

Motivation

Working on Implement zoom property for CSS

Related issues and pull requests

@dletorey dletorey requested a review from a team as a code owner May 7, 2024 15:00
@dletorey dletorey requested review from bsmth and removed request for a team May 7, 2024 15:00
@github-actions github-actions Bot added Content:CSS Cascading Style Sheets docs size/m [PR only] 51-500 LoC changed labels May 7, 2024
@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented May 7, 2024

Preview URLs

Flaws (4)

URL: /en-US/docs/Web/CSS/transform-function/scale
Title: scale()
Flaw count: 2

  • macros:
    • Wrong xref macro used (consider changing which macro you use). Error processing path /en-US/docs/Learn//CSS
    • Wrong xref macro used (consider changing which macro you use). Error processing path /en-US/docs/Learn//Getting_started_with_the_web/CSS_basics

URL: /en-US/docs/Web/CSS/zoom
Title: zoom
Flaw count: 2

  • macros:
    • Wrong xref macro used (consider changing which macro you use). Error processing path /en-US/docs/Learn//CSS
    • Wrong xref macro used (consider changing which macro you use). Error processing path /en-US/docs/Learn//Getting_started_with_the_web/CSS_basics

(comment last updated: 2024-05-13 10:36:52)

@dletorey dletorey marked this pull request as draft May 10, 2024 13:27
@dletorey dletorey marked this pull request as ready for review May 10, 2024 13:27
@dletorey dletorey closed this May 10, 2024
@dletorey dletorey reopened this May 10, 2024
@dletorey dletorey changed the title updated the current examples and added a new one zoom CSS Property May 10, 2024
Comment on lines +12 to +17
## Difference between zoom and transform:scale()

The `zoom` CSS property scales the whole element that is being targeted and this will have an effect on the layout of the page. When scaling the zoomed element scales from `top` `center` when using the default {{CSSXRef("writing-mode")}}.

{{cssxref("transform-function/scale", "transform: scale()")}} the element being targeted will remain the same and the content within will scale, if scaling makes the element larger than the containing element then {{CSSXRef("overflow")}} comes into place. When scaling the transformed element scales from the `center` (by default) this can be changed with {{CSSXRef("transform-origin")}} CSS property.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we can drop the H2 here and incorporate it right into the description.

What do you think about this?

Suggested change
## Difference between zoom and transform:scale()
The `zoom` CSS property scales the whole element that is being targeted and this will have an effect on the layout of the page. When scaling the zoomed element scales from `top` `center` when using the default {{CSSXRef("writing-mode")}}.
{{cssxref("transform-function/scale", "transform: scale()")}} the element being targeted will remain the same and the content within will scale, if scaling makes the element larger than the containing element then {{CSSXRef("overflow")}} comes into place. When scaling the transformed element scales from the `center` (by default) this can be changed with {{CSSXRef("transform-origin")}} CSS property.
The `zoom` CSS property scales the targeted element, which can affect the page layout. When scaling, the zoomed element scales from `top` and `center` when using the default {{CSSXRef("writing-mode")}}.
In contrast, an element scaled using {{cssxref("transform-function/scale", "scale()")}} will not cause layout recalculation and move other elements on the page. If scaling using `scale()` makes the contents larger than the containing element, then {{CSSXRef("overflow")}} comes into effect. Additionally, transformed elements scale from the `center` by default using `scale()`; this can be changed with {{CSSXRef("transform-origin")}} CSS property.

@@ -9,6 +9,12 @@ browser-compat: css.properties.zoom

The **`zoom`** [CSS](/en-US/docs/Web/CSS) property can be used to control the magnification level of an element. {{cssxref("transform-function/scale", "transform: scale()")}} should be used instead of this property, if possible. However, unlike CSS Transforms, `zoom` affects the layout size of the element.
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should we update this sentence that advises against using zoom? I don't think this applies any longer, right?

Copy link
Copy Markdown
Member

@bsmth bsmth left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you! 🙏🏻

@bsmth bsmth merged commit ccd398c into mdn:main May 13, 2024
@dletorey dletorey deleted the 32957-css-zoom branch May 17, 2024 10:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Content:CSS Cascading Style Sheets docs size/m [PR only] 51-500 LoC changed

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants