我有一个图像,我可以应用颜色色调,原始图像:


当应用背景色时。
我正在使用CSS来改变颜色:
<html>
<head>
<style type="text/css">
div.background
{
width:480px;
height:300px;
background:url(whiteroom.jpg) repeat;
}
div.transbox
{
width:480px;
height:300px;
background-color:#FF3E96;
opacity:0.5;
filter:alpha(opacity=60); /* For IE8 and earlier */
}
</style>
</head>
<body>
<div class="background">
<div class="transbox">
</div>
</div>
</body>
</html>如何使用javascript和CSS更改图像以反映所选颜色。我不需要从不同的颜色中选择,我需要的只是一种颜色和该颜色的不同深浅,例如我可以选择不同的粉色深浅。
谢谢您:)
发布于 2012-04-18 02:14:32
您可以使用CSS:
<div class="background">
<div id="tint" class="transbox blue"></div>
</div>
div.transbox.blue {
background-color:#0000ff;
}JS:
document.getElementByClassName('tint').setAttribute('class', 'transbox blue')https://stackoverflow.com/questions/10196506
复制相似问题