Using an absolute positional wrapper, we can use the img tag to add to the image, and then use span to contain the overlay text, for example:
<div id="wrapper"> <img src="image.png" alt="" /> <span id="text">A</span> </div>
Part one is simple: the absolute positioning of the span inside the relative positional wrapper, we can move the span to the correct position:
#wrapper { position: relative; } #wrapper #text { position: absolute; top: 50px; left: 50px; }
Part two is a little weirder. The problem is that when using fonts, font-size of 100px will not actually force the font to fill a field with a height of 100 pixels. You need to experiment to find the right font size. However, we can resize the span so that it has a width of 50 pixels and a height of 50 pixels:
#wrapper #text { display: inline-block; width: 100px; height: 100px; font-size: 100px; line-height: 1em; text-align: center; vertical-align: middle; }
Adding border will show that the range is the right size, and the letter is centered both vertically and horizontally.
Finally, part three is simple if we focus only on modern browsers. Using the rgba color with zero transparency, we can make the text invisible and selectable at the same time.
#wrapper #text { color: rgba(255, 255, 255, 0); }
Bonus: dragging things. . Dropping the jQuery UI Draggable , we can easily make the box draggable, Adding the cancel option so that the text remains optional, and we are done!
$('#wrapper').draggable({ cancel: '#text' });
See it all together: http://www.jsfiddle.net/yijiang/83W7X/