Closed Bug 214566 Opened 22 years ago Closed 22 years ago

"background-color" property not cascaded from external stylesheet when "background" shorthand property is specified inline

Categories

(Core :: DOM: CSS Object Model, defect)

x86
Windows XP
defect
Not set
minor

Tracking

()

RESOLVED INVALID

People

(Reporter: Karl, Unassigned)

References

()

Details

(Keywords: css2)

Attachments

(2 files, 1 obsolete file)

User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.5b) Gecko/20030728 Build Identifier: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.5b) Gecko/20030728 The unspecified "initial" property (transparent) is applied instead of the "background-color" specified in the external stylesheet, when the shorthand "background" property is used to set other background properties in the <style> section of the document. It seems to me that a specified background-color (even from an external stylesheet) should be more "important" than the "initial" value that backround-color takes on when unspecified In Internet Explorer the externally-specified background-color cascades through properly. Reproducible: Always Steps to Reproduce: 1. Make an inline stylesheet that uses a shorthand background property for BODY, but don't specify a background color 2. Create an external stylesheet that specifies blue background-color Actual Results: Displayed a white (transparent) background Expected Results: Display a blue background There is a workaround: In the external stylesheet use !important with the background-color property, and then it will cascade through and be used instead of the initial "transparent" value
Keywords: css2
Attached file External stylesheet
Attached file simplified testcase (obsolete) —
Comment on attachment 128916 [details] simplified testcase ><HTML><HEAD><TITLE>External Stylesheets</TITLE> > > ><LINK type="text/css" href="http://bugzilla.mozilla.org/attachment.cgi?id=128915&action=view" rel="stylesheet"/> > ><STYLE type="text/css"> >body {background: url("http://mozilla.org/images/mozilla-banner.gif") no-repeat fixed left center} ></STYLE></HEAD> ><BODY> ></BODY></HTML>
Attachment #128916 - Attachment is obsolete: true
Attached file simplified testcase
> It seems to me that a specified background-color (even from an external > stylesheet) should be more "important" than the "initial" value that > backround-color takes on when unspecified Per the CSS2 specification, the declaration: background: url("http://mozilla.org/images/mozilla-banner.gif") no-repeat fixed left center; is _precisely_ equivalent to the declarations: backround-image: url("http://mozilla.org/images/mozilla-banner.gif"); background-repeat: no-repeat; background-position: left center; background-attachment: fixed; background-color: transparent; The rendering should be identical regarless of whether you use the shorthand or longhand form. If the rendering is different in IE, that is a bug in IE. Now the inline style has cascade precedence over the linked stylesheet, so the "background-color: transparent" should override the background-color setting in the linked sheet, unless the latter is marked !important.
Status: UNCONFIRMED → RESOLVED
Closed: 22 years ago
Resolution: --- → INVALID
So would this bug be better classified as an Enhancement, or is CSS strictly hands-off for enhancements?
This bug is just invalid. "Enhancing" CSS in the way you would want here is explicitly prohibited by the CSS spec, since it leads to non-interoperable implementations.
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: