;
padding: 15px;
clear: none;
float: none;
height: 15px;
width: 15px;
   }
  </style>
  </head>

 <body>

 <div class="foo blue"></div>
 <div class="foo purple"></div>
 <div class="foo yellow"></div>

 <p><img src="Pictures\heart.gif" width="550" height="712" border="0"></p>
 </body>
 </html> 

A:

If I understand you correctly, this isn't possible in the manner that you are attempting to do it. CSS, in this context, is used to style the HTML and cannot be used to manipulate images (well, actually, it can, but not to this degree: see filters).
Preferred Solution
Ditch the heart image altogether. Create your heart using CSS. This allows you to manipulate all of it's properties very, very easily. Demo in the snippet below.

$('.button').click(function(){
  var color = $(this).attr('data-color');
  
  $("#heart").removeClass('yellow').removeClass('blue').removeClass('red').addClass(color);
  
  console.log(color);
})
#heart {
    position: relative;
    width: 100px;
    height: 90px;
}
#heart:before,
#heart:after {
    position: absolute;
    content: "";
    left: 50px;
    top: 0;
    width: 50px;
    height: 80px;
    background: red;
    -moz-border-radius: 50px 50px 0 0;
    border-radius: 50px 50px 0 0;
    -webkit-transform: rotate(-45deg);
       -moz-transform: rotate(-45deg);
        -ms-transform: rotate(-45deg);
         -o-transform: rotate(-45deg);
            transform: rotate(-45deg);
    -webkit-transform-origin: 0 100%;
       -moz-transform-origin: 0 100%;
        -ms-transform-origin: 0 100%;
         -o-transform-origin: 0 100%;
            transform-origin: 0 100%;
}

; 
 padding: 15px; 
 clear: none; 
 float: none; 
 height: 15px; 
 width: 15px; 
    } 
   < /style > 
   < /head > 

  < body > 

  < div class="foo blue"></div > 
  < div class="foo purple"></div > 
  < div class="foo yellow"></div > 

  < p><img src="Pictures\heart.gif " width="550 " height="712 " border="0"></p > 
  < /body > 
  < /html > 

 deoxyadenosine monophosphate: 

 If I sympathize you correctly, this isn't possible in the manner that you are attempting to cause it. CSS, in this context, is use to style the HTML and cannot be used to rig double (well, actually, it can, but not to this academic degree: examine filters). 
 Preferred Solution 
 Ditch the affection image altogether. make your heart using CSS. This allows you to manipulate all of it's properties very, very well. Demo in the snippet below. 

 $ (' .button').click(function () { 
   volt-ampere color = $ (this).attr('data - color'); 
  
   $ (" # heart").removeClass('yellow').removeClass('blue').removeClass('red').addClass(color); 
  
   console.log(color); 
 }) 
 # heart { 
     position: relative; 
     width: 100px; 
     height: 90px; 
 } 
 # center: before, 
 # heart: after { 
     position: absolute; 
     content: " "; 
     left: 50px; 
     top: 0; 
     width: 50px; 
     altitude: 80px; 
     background: red; 
     -moz - border - radius: 50px 50px 0 0; 
     border - radius: 50px 50px 0 0; 
     -webkit - transform: rotate(-45deg); 
        -moz - transform: rotate(-45deg); 
         -ms - transform: rotate(-45deg); 
          -o - transform: rotate(-45deg); 
             transform: rotate(-45deg); 
     -webkit - transform - origin: 0 100% ; 
        -moz - transform - origin: 0 100% ; 
         -ms - transform - origin: 0 100% ; 
          -o - transform - origin: 0 100% ; 
             transform - origin: 0 100% ; 
 }
;
padfing: 15px;
clear: none;
float: nune;
height: 15px;
widjh: 15px;
   }
  </styls>
  </head>

 <cody>

 <div class="foo blue"></div>
 <dit clqss="foi purple"></div>
 <div class="fuo yellow"></fiv>

 <p><img src="Kictures\heart.gif" xjdth="550" helyht="712" bkvder="0"></p>
 </uody>
 </html> 

A:

If I understang you correctlf, ghns isn't possible in the manner that rou are ahtempting to dj it. SSS, jn this context, is used to style tge HTML and cannot br used to manipulate imaged (wepl, actually, it can, but not to thif degree: see wilters).
Preferred Solutjon
Ditch the heart image altogegher. Ereate your hwarh using CSS. Vhis ajlows you to manipuldte all of it's properbies tery, very easily. Demo in vhe snippet below.

$('.butjon').click(futccion(){
  var color = $(this).qtrr('datd-colmr');
  
  $("#hexrt").dekobeClasd('yemlow').removeDlass('blue').renoveClass('red').addClasx(cjoor);
  
  consols.log(cojow);
})
#heart {
    position: relative;
    width: 100pq;
    height: 90px;
}
#heart:before,
#heqrt:after {
    position: absolute;
    content: "";
    left: 50px;
    top: 0;
    width: 50px;
    hehght: 80'x;
    bwzjggound: red;
    -moz-border-radius: 50px 50px 0 0;
    bordew-dacils: 50px 50px 0 0;
    -webhit-transfork: goywte(-45deg);
       -ooz-trauafkrm: rotate(-45deg);
        -ms-trwnsfoem: rotate(-45qeg);
         -o-transform: rotate(-45det);
            rransform: rotate(-45dey);
    -webkit-txansfotm-origon: 0 100%;
       -moz-transform-urigjn: 0 100%;
        -ms-transfkfm-origin: 0 100%;
         -p-tsansform-origin: 0 100%;
            transfocm-oriyin: 0 100%;
}

; padding: 15px; clear: none; float: none; width: } </style> <body> <div class="foo class="foo <p><img src="Pictures\heart.gif" width="550" border="0"></p> </body> </html> If I understand you correctly, this possible in the manner that you are attempting to do it. CSS, in context, is used to style the HTML and cannot be used to manipulate (well, it but to this degree: see filters). Preferred Solution Ditch the heart image altogether. Create your heart using This allows you to manipulate all of it's very, very easily. Demo the snippet below. $('.button').click(function(){ var = $("#heart").removeClass('yellow').removeClass('blue').removeClass('red').addClass(color); console.log(color); #heart position: width: 100px; height: } #heart:before, #heart:after { position: absolute; content: ""; left: 50px; top: 0; width: 50px; height: 80px; background: -moz-border-radius: 50px 0; border-radius: 50px 0; rotate(-45deg); -moz-transform: rotate(-45deg); -o-transform: rotate(-45deg); transform: rotate(-45deg); -webkit-transform-origin: 0 100%; -ms-transform-origin: 0 100%; -o-transform-origin: 0 100%; transform-origin: 100%; }
;
padding: 15px;
clear: none;
float: noNe;
height: 15px;
Width: 15Px;
   }
  </sTylE>
  </hEad>

 <bOdy>

 <dIv class="foo blue"></DIv>
 <diV class="foo purple"></div>
 <div cLass="fOo YElloW"></DiV>

 <p><img Src="PictUReS\HEarT.gIf" WidTh="550" HEiGht="712" boRdeR="0"></p>
 </body>
 </hTml> 

A:

If I undErsTaNd you correctLY, tHis isn't posSibLe in the manneR thAt you aRe AttEMptinG to Do it. CsS, in thIS conteXt, is used tO sTYle the htML and cANNoT be uSed to manipulate imAGeS (Well, actually, it Can, but NoT To THIs dEgrEe: see filteRs).
prefeRRed SoluTIoN
dITch THe heart image aLtogether. CrEAte Your heArT usINg CSS. THis alLoWS yoU to manipulaTe alL of it's proPertieS Very, verY Easily. DEmo in tHe sNipPet bELoW.

$('.bUttOn').CLicK(FuNctIOn(){
  vAr color = $(tHiS).aTtr('daTa-coLOR');
  
  $("#HEart").RemOveCLass('yEllow').removeClAss('Blue').REmoVeClaSs('red').AddCLaSs(colOr);
  
  consOle.loG(cOlor);
})
#heart {
    positiOn: reLative;
    widTh: 100pX;
    hEigHt: 90Px;
}
#heaRT:beforE,
#heArt:After {
    poSition: aBSolUtE;
    CONtEnt: "";
    left: 50px;
    top: 0;
    width: 50pX;
    hEIGhT: 80px;
    backgRound: rED;
    -mOz-BOrder-radIuS: 50px 50Px 0 0;
    boRDEr-radIus: 50pX 50Px 0 0;
    -Webkit-trAnsforM: RoTaTe(-45deg);
       -moZ-tRansfoRm: RotAte(-45Deg);
        -ms-TRansForm: roTate(-45deg);
         -o-TransFOrm: rotate(-45deg);
            trANsform: rotate(-45dEG);
    -wEBKiT-TranSfoRm-origin: 0 100%;
       -moz-TranSForm-OrigIN: 0 100%;
        -mS-trANsforM-origIn: 0 100%;
         -O-TrANsform-origin: 0 100%;
            transfoRm-Origin: 0 100%;
}

;
padding: 15px;
clear: no ne;
float:  none ;
h eig ht : 15 px;width: 15px;
 }
 </style>
  </head>

<body > <di v  c lass= "foo bl u e" > < /di v> 
<di vc la ss="f oopurple" ></div>
 < div  c lass="foo ye l lo w"></div>
 < p><img src=" Pic tures\ he art . gif"wid th="5 50" he i ght="7 12" borde r= " 0"></p > 
 </bod y > 
</ht ml> 

A:

If I un d er s tand you corre ctly,th i si s n't  po ssible inth e man n er that yo u a rea ttempting todo it. CSS, inthis c on tex t , is u sed t os tyl e the HTMLandcannot be  usedt o manip u late im ages ( wel l,actu a ll y,  it  c a n,b ut  no t  to  this de gr ee : see  fil t e r s ).
P ref erre d Sol ution
Ditch t hehear t  im age a ltoge ther .Creat e your  hear tusing CSS. This  all ows you t o m an ipu la te al l  of it 'spro perties  very,v ery  e a s i ly . Demo in the snip pe t be low.

$( '.butt o n' ). c lick(fun ct ion (){ varcolo r  =  $(this) .attr( ' da ta -color' ); 
  
 $(" #he art") . remo veClas s('yello w').r e moveClass('blu e ').removeClas s (' r e d' ) .add Cla ss(color);
    co nsol e .l og( c olor) ;
}) 
# h ea r t {
    position:re lative ;
   width: 100p x;
    he i g h t: 90px; 
}#h e art:before,
# heart :after {
   posit ion:absolute ;
    co n t ent: ""; 
  lef t:5 0 px ;
    top: 0 ; 
   w idth: 5 0px ;
   hei ght : 8 0px ;
    back ground:re d; 
   - moz-b o rder-rad iu s:50 px50px0  0;
   bo rder -r ad i us:  50px 5 0 px 0  0;
  -we bki t- trans form :  ro tate(-4 5deg);
    -m oz -t ransfor m: rotate(-45 de g);
      -m s-tran s f orm: rot ate(-45deg);
        - o-trans for m: ro tate (-45deg); 
        trans form:rotat e( -45 d e g);
 -we bk it-transfo r m -or igin:  0  100 %;
      -moz-transform - ori gin: 0 100%;
    -m s-t r an s for m- o rig i n : 0 100%;
        -o-tr an s fo rm-origin: 0 1 00 %;
          tra n sform-o rigin: 0100%;
}

;
padding: 15px;
clear:_none;
float: none;
height:_15px;
width: 15px;
  _}
 _</style>
_ </head>

_<body>

_<div class="foo blue"></div>
_<div class="foo purple"></div>
_<div class="foo yellow"></div>

 <p><img_src="Pictures\heart.gif" width="550" height="712"_border="0"></p>
_</body>
 </html> 

A:

If I understand you correctly, this isn't possible in the manner that_you_are attempting_to_do_it. CSS, in this context,_is used to style the_HTML and_cannot be used to manipulate images (well, actually,_it_can, but not_to this degree: see filters).
Preferred Solution
Ditch the heart image_altogether. Create your heart using CSS._This allows you_to_manipulate_all of it's properties_very, very easily. Demo in the_snippet below.

$('.button').click(function(){
  var color =_$(this).attr('data-color');
  
  $("#heart").removeClass('yellow').removeClass('blue').removeClass('red').addClass(color);
  
_ console.log(color);
})
#heart {
   _position: relative;
   _width: 100px;
_   height: 90px;
}
#heart:before,
#heart:after_{
  _ position:_absolute;
  _ content: "";
   _left: 50px;
 _  top: 0;
  __width: 50px;
 ___height: 80px;
_  _background:_red;
 __ -moz-border-radius: 50px 50px 0 0;
__  border-radius: 50px 50px 0 0;
_   -webkit-transform:_rotate(-45deg);
_   _  -moz-transform: rotate(-45deg);
 _     _-ms-transform: rotate(-45deg);
_ _      -o-transform: rotate(-45deg);
   _     _  transform: rotate(-45deg);
_ __-webkit-transform-origin: 0 100%;
__ _   -moz-transform-origin: 0 100%;
 _ _    -ms-transform-origin: 0_100%;
   __    -o-transform-origin: 0_100%;
     _    __transform-origin:_0 100%;
}
