Results 1 to 3 of 3

Thread: about background and colour

  1. #1

    Thread Starter
    Member
    Join Date
    Oct 2019
    Posts
    44

    about background and colour

    Why background and color are the separate properties if they should always be set together?
    < advertising removed by moderator >

  2. #2
    Super Moderator dday9's Avatar
    Join Date
    Mar 2011
    Location
    South Louisiana
    Posts
    11,711

    Re: about background and colour

    Background and Color are separate properties and you can set one without the other. Per MDN, here are the descriptions of the two:

    Background:
    The background shorthand CSS property sets all background style properties at once, such as color, image, origin and size, or repeat method.
    Color
    The color CSS property sets the foreground color value of an element's text and text decorations, and sets the currentcolor value. currentcolor may be used as an indirect value on other properties and is the default for other color properties, such as border-color.
    "Code is like humor. When you have to explain it, it is bad." - Cory House
    VbLessons | Code Tags | Sword of Fury - Jameram

  3. #3
    New Member techeshta's Avatar
    Join Date
    Jun 2020
    Location
    India
    Posts
    2

    Re: about background and colour

    The background property is a complex property in CSS, and if it is combined with color, the complexity will further increase. Color is an inherited property while the background is not. So this can make confusion further.

    **Links removed by Site Administrator so it doesn't look like you're spamming us. Please don't post them again.**

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width