I am using CSS Sprite Technique with a background image that looks something like this:

CSS code for icons:
div.icon { background-color: transparent; background-image: url("/images/icons.png"); background-position: 0 0; background-repeat: no-repeat; display: inline-block; height: auto; vertical-align: text-top; width: auto; } div.icon:empty { width:16px; height:16px; } div.icon:not(:empty) { padding-left:20px; } div.icon.attenuation { background-position: 0 0; }
My icons can be used as follows:
<div class="icon warning"></div>
I want to add text inside my icons, for example:
<div class="icon warning">There is a warning on this page</div>
But the problem is that the background image covers the entire text area:

Question: how can I use only part of the image as a background image for part of my element?
Notes:
width - 16px for div.icon does not help.
Alexstack
source share