Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

background-repeat: rewrite #33534

Merged
merged 12 commits into from May 13, 2024
Merged

background-repeat: rewrite #33534

merged 12 commits into from May 13, 2024

Conversation

estelle
Copy link
Member

@estelle estelle commented May 10, 2024

rewrote to match standard way of writing css property pages.

added description.

removed table of values, converting to definition list

round was explained incorrectly. This has been fixed (images don't get squashed, just stretched)

(the guide in the see also that may be a "broken link" is going to be added to the site when #33461 is merged.)

@estelle estelle requested a review from a team as a code owner May 10, 2024 10:35
@estelle estelle requested review from bsmth and removed request for a team May 10, 2024 10:35
@github-actions github-actions bot added Content:CSS Cascading Style Sheets docs size/m 51-500 LoC changed labels May 10, 2024
Copy link
Contributor

github-actions bot commented May 10, 2024

Preview URLs

Flaws (3)

URL: /en-US/docs/Web/CSS/background-repeat
Title: background-repeat
Flaw count: 3

  • 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
  • broken_links:
    • Can't resolve /en-US/docs/Web/CSS/CSS_box_sizing/Understanding_aspect-ratio

(comment last updated: 2024-05-13 17:12:21)

By default, the repeated images are clipped to the size of the element, but they can be scaled to fit (using `round`) or evenly distributed from end to end (using `space`).
## Description

The property accepts two `<repeat-style>` keyterms, or one keyterm as a shorthand for the two values. When two values are provided, the first value defines the horizontal repetition behavior and the second value defines the vertical behavior.
Copy link
Member

Choose a reason for hiding this comment

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

Do we define "keyterm" anywhere? It might be nice to explain that.


The property accepts two `<repeat-style>` keyterms, or one keyterm as a shorthand for the two values. When two values are provided, the first value defines the horizontal repetition behavior and the second value defines the vertical behavior.

The default value is `repeat repeat`. By default, the background image maintains its intrinsic {{glossary("aspect ratio")}}, repeating both horizontally and vertically to cover the entire background paint area, with edge images being clipped to the size of the element. Property values can be used to repeat only horizontally, vertically, or not at all.
Copy link
Member

Choose a reason for hiding this comment

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

Property values can be used to repeat only horizontally, vertically, or not at all.

Does this mean 'a background image can be repeated either horizontally or vertically'?


The default value is `repeat repeat`. By default, the background image maintains its intrinsic {{glossary("aspect ratio")}}, repeating both horizontally and vertically to cover the entire background paint area, with edge images being clipped to the size of the element. Property values can be used to repeat only horizontally, vertically, or not at all.

The repeating images can be evenly spaced apart, ensuring it maintains its aspect ratio without being clipped, with the `space` value. When space is used, if the background paint area has a different aspect ratio than the image or does not otherwise have a size that a multiple of the background size in both directions, there will be areas not covered by the background image.
Copy link
Member

Choose a reason for hiding this comment

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

Can we link to 'paint area' if that's described in more detail somewhere?


The repeating images can be evenly spaced apart, ensuring it maintains its aspect ratio without being clipped, with the `space` value. When space is used, if the background paint area has a different aspect ratio than the image or does not otherwise have a size that a multiple of the background size in both directions, there will be areas not covered by the background image.

Alternatively, the repeated background image can be scaled to cover the entire area without clipping, by setting the `round` value. This value by lead the background image to be stretched if the aspect ratio of the background image is not the same as the paint area's aspect ratio. With `round`, the repeated images will stretch to fill all the available space until there is room to add an additional repeated image. When an additional image is able to fit. For example, if an image has a width of `100px`, the image will be repeated 10 times in the horizontal direction when the container is 1000px to 1099px wide, with the image being stretch to 109.9px wide. If the width of the container increases by 1px, to be 1100px wide, an 11th image will fit, with all the images being 100px wide again.
Copy link
Member

Choose a reason for hiding this comment

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

There's a sentence fragment at:

additional repeated image. When an additional image is able to fit.

Copy link
Member

Choose a reason for hiding this comment

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

if an image has a width of 100px, the image will be repeated 10 times in the horizontal direction when the container is 1000px to 1099px wide, with the image being stretch to 109.9px wide.

I'm not sure I follow this; if the container width is between 1000px and 1100px, then the repeated image will be 100px (at 1000px container width), then stretched until 11 fit at 100px each again (at 1100px container width)?

@bsmth
Copy link
Member

bsmth commented May 10, 2024

General question after having a read through: what's the starting point of images? Is it top-left 0,0 of an element's position or is there anything else that affects this (directionality / margins etc.)

@bsmth
Copy link
Member

bsmth commented May 10, 2024

Thanks a lot, @estelle! Looking good, mostly some open questions on some concepts I wasn't sure about!

@estelle
Copy link
Member Author

estelle commented May 10, 2024

Thanks a lot, @estelle! Looking good, mostly some open questions on some concepts I wasn't sure about!

@bsmth. Thank you for the quick review. I rewrote a lot of it, and think I addressed all your questions.

@estelle estelle requested a review from bsmth May 10, 2024 19:39
Copy link
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.

Thanks, Estelle. Two formatting suggestions for you but leaving a +1 👍🏻

Co-authored-by: Brian Thomas Smith <brian@smith.berlin>
@estelle estelle merged commit ab8b372 into mdn:main May 13, 2024
8 checks passed
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 51-500 LoC changed
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants