Closed Bug 302929 Opened 19 years ago Closed 19 years ago

background:none cancels cascaded background color

Categories

(Core :: CSS Parsing and Computation, defect)

1.0 Branch
x86
Windows 98
defect
Not set
normal

Tracking

()

RESOLVED INVALID

People

(Reporter: ve3ll, Assigned: dbaron)

Details

User-Agent:       Mozilla/5.0 (Windows; U; Win98; en-US; rv:1.8b3) Gecko/20050712 Firefox/1.0+
Build Identifier: Mozilla/5.0 (Windows; U; Win98; en-US; rv:1.8b3) Gecko/20050712 Firefox/1.0+

in the following test situation the background color is
eliminated with background:none  only the image should
be eliminated as none is associated with images.
if i had need to eliminate the bg color, i would use transparent.
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html lang="en" xml:lang="en" xmlns="http://www.w3.org/1999/xhtml">
<head><title>cssColor: VE3LL@RAC.CA</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<style type="text/css">
body {background:honeydew;color:black;text-align:left;
      margin:20px 35px;border:0px;padding:0px}
div {margin:0px;border:0px;padding:0px}
div.c {text-align:center;margin:auto}
h1 {font-size:200%;font-family:"Lucida Handwriting",cursive;display:block;
    font-weight:bold;margin:0px;border:0px;padding:0px;text-align:center}
h2 {font-size:150%;background:url(images/tartan.gif) repeat-x #deadff;
    color:lightyellow;text-indent:15px;clear:both}
/* default block element and class overrides */
body {background:#ffffe0}  /* unique color background */
h2 {background:none;color:black} /* override yellow on tartan */
</style></head>

<body><h2>cssColor: VE3LL@RAC.CA</h2>
<p>This is a short demo of how the mozilla family handles a cascaded
background of none... It sets both image and background to nil for the
element. But <em>none</em> should only affect the image. The color as
set in the cascade should remain! Only the keyword transparent should
shut off the color setting.</p>
<p><a href="http://www.w3.org/TR/CSS21/colors.html#propdef-background-color">
w3.org reference</a> gives the detailed recommendation.</p>

<div class="c"><hr id="bot" />
<a href="mailto:VE3LL@RAC.CA?Subject=[cssColor.htm]">Comments</a> |
[cssColor.htm:2005 08 01]</div></body></html>


Reproducible: Always

Steps to Reproduce:
1. run included html
2.
3.

Actual Results:  
no bg color on header

Expected Results:  
displayed a colored bg for the header
Amaya does this right to follow the w3.org recommendation ;-]
moz, msie, opera are in agreement but non-conformant.
Assignee: nobody → dbaron
Component: General → Style System (CSS)
Product: Firefox → Core
QA Contact: general → ian
Version: unspecified → 1.0 Branch
http://www.w3.org/TR/CSS21/about.html#shorthand says:
  When values are omitted from a shorthand form, each "missing" property is
  assigned its initial value (see the section on the cascade).
so this behavior is correct.
Status: UNCONFIRMED → RESOLVED
Closed: 19 years ago
Resolution: --- → INVALID
Since the value of color was previously assigned to 
h2 (on the previous line here but in another stylesheet in
real time), shouldn't the second h2 rule take the previous
cascaded h2 value rather than assuming
the default or implementer's value.

if this is not true then it is not cascading .... 
oops -- i meant in the previous h2 rule (ie #deadff)
not the previous line which refers to body rule.
A shorthand property is always equivalent to specifying the same list of
properties, whether or not they're actually listed.  So 'background: none
transparent', 'background: none', and 'background: transparent' all mean exactly
the same thing.
i guess i can use background-image:none to achieve the
desired cancelling of the tartan image ... 
but this is not intuitive ... one would normally
anticipate falling back to next setting rather than
all the way back to nil...   oh well i can work around
You need to log in before you can comment on or make changes to this bug.