Put them in a div aligned right:
Then use js to set the width of the div to the image:
$('.container').width($('.image1').width());
CSS:
.image1 {
width: 50px;
}
.image2 {
width: 30px;
}
Though it is better with js it is not necessary for it to work
Fiddle: http://jsfiddle.net/GuTZ3/2/