JSFiddle - React, Tailwind, and code Playground
HTML
<div class="background">
<img id="background" src="https://www.gravatar.com/avatar/8e4dd8ae2d6385e4c857861c98b4f3ee?d=wavatar&s=60" />
</div>
JavaScript
$('#background').each(function() {
var image = $(this).attr('src');
$(this)
.hide()
.parents('.background')
.css({
"background": 'url(' + image + ')',
"height": '100px',
"width": '100px'
})
.append('TEXT');
});