Source code

Revision control

Copy as Markdown

Other Tools

Test Info:

<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>CSS Backgrounds and Borders: getComputedStyle().backgroundColor</title>
<meta name="assert" content="background-color computed value is a computed color.">
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script src="/css/support/computed-testcommon.js"></script>
<style>
#target {
color: lime;
}
</style>
</head>
<body>
<div id="target"></div>
<script>
test_computed_value("background-color", "currentcolor", "rgb(0, 255, 0)");
test_computed_value("background-color", "red", "rgb(255, 0, 0)");
test_computed_value("background-color", "#00FF00", "rgb(0, 255, 0)");
test_computed_value("background-color", "rgb(0, 0, 255)");
test_computed_value("background-color", "rgb(100%, 100%, 0%)", "rgb(255, 255, 0)");
test_computed_value("background-color", "hsl(120, 100%, 50%)", "rgb(0, 255, 0)");
test_computed_value("background-color", "transparent", "rgba(0, 0, 0, 0)");
</script>
</body>
</html>