Forums

The forums ran from 2008-2020 and are now closed and viewable here as an archive.

Home Forums CSS html or body for background

  • This topic is empty.
Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
    Posts
  • #248623
    justcodeit
    Participant

    https://www.w3.org/TR/css3-background/#special-backgrounds

    This tells me what happens in the context of applying a background, but it doesn’t say why it’s recommended that a background be applied to the <body>.

    If the background is specified in the root it spreads throughout the canvas. If the background is declared in the body, while the root is transparent, the background is still treated as if it was specified by the root.

    If this preference as mentioned in the spec can be explained in simple terms it will be appreciated.

    #248652
    Shikkediel
    Participant

    I’m not exactly sure which part of the huge doc you’re referring to but I can only imagine there isn’t any background to style above the body level.

    #248658
    I.m.learning
    Participant

    You can add a background to <html>. It will create a border. I used it in my site, and it is not inherited by the body at all. I think the main recommendation is due to inheritance.

    I also use DOM to create a preference to change between colors and an image.

Viewing 3 posts - 1 through 3 (of 3 total)
  • The forum ‘CSS’ is closed to new topics and replies.