w3c / w3c/csswg-drafts

[css-backgrounds-4] Background origin for x and y axes

Open
#3,312 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

css-backgrounds-4
Dominant language
Bikeshed
Stars
4.9k
Forks
816
PR merge metrics
PR metrics pending

Description

It would be useful to have background-origin-x and background-origin-y properties, similarly to background-position-x and background-position-y.

Consider this example:

<input class="with-icon">
input
{
  padding: 20px;
}

/* old way */
.with-icon
{
  padding-left: 40px; /* icon will be placed within this left padding */
  background: no-repeat 14px 50%/auto 60% url('image.svg'); /* icon size has magic numbers */
}

/* new way */
.with-icon
{
  padding-left: 40px;
  background: no-repeat 14px 50%/auto contain url('image.svg'); /* icon size is relative to content area of the input */
  background-origin-y: content-box;
}

We can't use simply background-origin here, because the background position of the icon would we within the content boundaries of the input, and thus would require to have negative numbers.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reviewing the existing background-position-x and background-position-y definitions, then compare their behavior with the background-origin proposal in this issue. Determine whether separate x and y origin properties fit the CSS Backgrounds specification; completion requires an agreed specification change and corresponding wording.

Written by the indexing model from the issue text.

Assessment

Tech stack
css
Domain
frontend, web-dev
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.