You need to sign in to do that
Don't have an account?

Style is not working for apex:Image
Hi All,
I want to set the different color for the image when a button click. I tried using style/styleclass ,but the img color is not changing.
<apex:image id="ImgId" url="/servlet/servlet.FileDownload?file=01590000000xTAS" style="Color:black;background-color:black;" width="250" height="150"/>
pls help me out..
Hi
I tried this in the visual force page it is working fine.
I think it might be the problem with browser .
Just clear the cache of the browser and try it.
Hope it will work.
Hi Anil,
In my developer edition I again tried with new page: actual color of image remains same,it doesnt change into red frm black.
I even cleared my cache and tried IE and firefox.
<apex:page >
<apex:image id="ImgId" url="/servlet/servlet.FileDownload?file=01590000000x59l" style="Color:Red;background-color:white;" width="250" height="150"/>
</apex:page>
This is the image (loading spin) I downloaded frm google & added jpge into DOC folder----->
:http://www.google.fr/imgres?um=1&hl=en&sa=N&tbo=d&biw=1024&bih=629&tbm=isch&tbnid=sj6RCQgpdIFenM:&imgrefurl=http://chemvlab.org/vlab/stoic2.html&docid=5JDjf-blRmSmbM&imgurl=http://chemvlab.org/vlab/images/loadingSpin.gif&w=420&h=550&ei=WF3lUMnIGITUsgbztIDICQ&zoom=1&iact=rc&sig=109230692546619683564&page=1&tbnh=160&tbnw=115&start=0&ndsp=18&ved=1t:429,r:2,s:0,i:94&tx=466&ty=244
You can try this -
<apex:page>
<style>
.imgbg{
background-color:black;
color:black;
}
.imgbg:hover{
background-color:black;
color: red;
}
<apex:image ........................ id ="imgbg"/>
</apex:page>
And may be one issue in you code, U changed backgroundcolor, It will not display till image is .png type. You must change the code, something like-
<apex:page>
<table>
<tr>
<td style="Color:black;background-color:black;">
<apex:image id="ImgId" url="/servlet/servlet.FileDownload?file=01590000000xTAS" width="250" height="150"/>
</td>
</tr>
</table>
</apex:page>
Change the color of td that will display in back.
Please marked as solution, for other person help on a same query
Thank you,
Raj Jha