Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7970813
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 4, 20262026-06-04T07:29:19+00:00 2026-06-04T07:29:19+00:00

I just read that you are not allowed to mix values, ex: background-position: top

  • 0

I just read that you are not allowed to mix values, ex: background-position: top 50%;

However, I am not sure whether the following lines are ambiguous:

background-position: 0 50%; //can the 0 be confused as 0px?
background-position: 0 50px; //can the 0 be confused as 0%?

My concern is that they might cohere in a forbidden way and cause unexpected bugs.

Do you think this can happen and what makes you think that?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-04T07:29:20+00:00Added an answer on June 4, 2026 at 7:29 am

    You are allowed to combine keywords with percentage values or length values in CSS2.1 … but you weren’t in CSS2 (I mean, CSS 2.0). That should be the source of the confusion.

    From W3C CSS2.0 on background-position

    Value: [ [<percentage> | <length> ]{1,2} | [ [top | center | bottom] || [left | center | right] ] ] | inherit
    (…)
    Values have the following meanings:
    – <percentage> <percentage> blah
    – <length> <length> blah
    – top left and left top (and 2 dozens of keyword combinations) blah

    If only one percentage or length value is given, it sets the horizontal position only, the vertical position will be 50%.
    If two values are given, the horizontal position comes first.
    Combinations of length and percentage values are allowed, (e.g., ‘50% 2cm’).
    Negative positions are allowed.
    Keywords cannot be combined with percentage values or length values (all possible combinations are given above).

    From W3C CSS2.1 on background-position

    Value: [ [ <percentage> | <length> | left | center | right ] [ <percentage> | <length> | top | center | bottom ]? ] | [ [ left | center | right ] || [ top | center | bottom ] ] | inherit
    (…)
    If only one value is specified, the second value is assumed to be ‘center’.
    If at least one value is not a keyword, then the first value represents the horizontal position and the second represents the vertical position.
    Negative <percentage> and <length> values are allowed.

    Comparison

    If you compare the possible Values in CSS2.0 and CSS2.1, it’s pretty clear you could combine (percentage and length) OR (keywords) and can now combine any of the three types of value with any of the three types (OT: and you’ve been allowed forever to only use 1 value, the second one then being 50%/center).

    Bold text and lack of any other indication in CSS2.1 also implies that, when you’ve 2 values, you can have 0, 1 or 2 keywords thus that you can encounter, as a browser, the case where there’s exactly 1 keyword.

    From what I recall, I never encountered any problem with IE6+, only with the W3C validator (jigsaw) when it validated against CSS2 by default or something like that.
    The CSS validator seems happy with body { background-position : 40cm left; }

    CSS2.1 has been a W3C Recommendation for nearly a year (7 june 2011) so that shouldn’t cause new confusion.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I just read that C99 has double_t which should be at least as wide
I am new to Java. I just read that class variables in Java have
I just read an article that explains the zero-copy mechanism. It talks about the
I've just read an article that supposedly introduced me to a new concept: Up
I've just read some related questions that came up when I typed the subject,
I've just read in a file that is something like: name: john, jane car:
I just read Factory Method. I understand that it provides a way to delegate
I just read about DNS protocol, and found, that the name field can be
I have two very short questions: 1 - I just read that DEXP() is
I've read that sending messages to nil is allowed in ObjC and I understand

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.