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 6142853
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T18:26:40+00:00 2026-05-23T18:26:40+00:00

I don’t see the difference between: html { background: #f1f1f1; } and body {

  • 0

I don’t see the difference between:

html {
    background: #f1f1f1;
}

and

body {
    background: #f1f1f1;
}

Any explanation?

  • 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-05-23T18:26:41+00:00Added an answer on May 23, 2026 at 6:26 pm

    There is no real difference (if you’re just talking about where to apply background, otherwise BoltClock’s answer to this other question is a better fit). html is an element, just like body is.

    Both are valid choices, and both will both work in all common browsers.

    The YUI Reset for instance, chooses to set a background on the html element instead of body:
    http://yui.yahooapis.com/3.3.0/build/cssreset/reset.css

    This requires that you set your background on html, for instance see: can't change body background color using CSS reset

    See: http://dev.w3.org/csswg/css3-background/#special-backgrounds

    The background of the root element becomes the background of the
    canvas and its background painting area extends to cover the entire
    canvas, although any images are sized and positioned relative to the
    root element as if they were painted for that element alone. (In other
    words, the background positioning area is determined as for the root
    element.) If the root’s ‘background-color’ value is ‘transparent’, the
    canvas’s background color is UA dependent. The root element does not
    paint this background again, i.e., the used value of its background is
    transparent.

    And:

    For documents whose root element is an HTML HTML element [HTML401] or
    an XHTML html element [XHTML11]: if the computed value of
    ‘background-image’ on the root element is ‘none’ and its
    ‘background-color’ is ‘transparent’, user agents must instead
    propagate the computed values of the background properties from that
    element’s first HTML BODY or XHTML body child element. The used values
    of that BODY element’s background properties are their initial values,
    and the propagated values are treated as if they were specified on the
    root element. It is recommended that authors of HTML documents specify
    the canvas background for the BODY element rather than the HTML
    element.

    What that wall of text is saying is demonstrated here:

    • background on just body: http://jsfiddle.net/hhtzE/
    • background on html and body: http://jsfiddle.net/hhtzE/1/
    • background only html: http://jsfiddle.net/hhtzE/2/
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

(Don't know if this is strictly on-topic, but I don't see any better Stack
I don't want PHP errors to display /html, but I want them to display
Don't be afraid to use any technical jargon or low-level explanations for things, please.
Don't ask why, but is there any way to suppress a failed linking error?
I don't have any experience in updating a Rails app and when I google
Don't yell at me! i have seen many threads claiming that HTML cannot be
Don't think this is a repost, difficult to search for the word between because
Don't you hate it when you have class Foobar { public: Something& getSomething(int index)
Don't let below code scare you away . The question is really simple, only
Don't be scared of the extensive code. The problem is general. I just provided

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.