JSFiddle - React, Tailwind, and code Playground

HTML

Copy the images as if text:<br />
<br />
X<img alt="i" src="http://bit.ly/1LGtQTQ" /><img alt="i" src="http://bit.ly/1LGtQTQ" />Y<br />
<br />
Try pasting it here, it should be 'XiiY':<br />
<input />


<br /><br /><br />

Canvas test:<br />
aX<canvas id="testCanvas" width="14" height="14"></canvas><span class="img2">i</span><canvas id="testCanvas2" width="14" height="14"></canvas><span class="img2">i</span>Ya

CSS

body {
    font-size: 14px;
}

img, span {
    display: inline-block;
    vertical-align: baseline;
    cursor: text;
    height: 1em;
}

div {
    display: inline;
    position: relative;
    //overflow:hidden;
    cursor: text;
}
.img2 {
    //position: absolute;
    //left: 0px;
    //top: 0px;
    //width: 100%;
    //height: 100%;
    margin-left: -14px;
    width: 14px;
    height: 18px;
    vertical-align: bottom;
    font-size: 10em;
    overflow: hidden;
}
canvas {
    display: inline;
    //outline: 1px solid black;
    width: 1em;
    height: 1em;
    
    -webkit-touch-callout: none;
    -webkit-user-select: none;
    -khtml-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
    user-select: none;
}

JavaScript

var img = new Image();
img.onload = function() {
    var canvas = document.getElementById('testCanvas');
    var ctx = canvas.getContext('2d');
    ctx.drawImage(img, 0, 0);
    
    canvas = document.getElementById('testCanvas2');
    ctx = canvas.getContext('2d');
    ctx.drawImage(img, 0, 0);
};
img.src = "http://bit.ly/1LGtQTQ";