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<div><canvas id="testCanvas" width="14" height="14"></canvas><img class="img2" alt="i" src="http://less.ly/pixel.gif"></img></div><div><canvas id="testCanvas2" width="14" height="14"></canvas><img class="img2" alt="i" src="http://less.ly/pixel.gif"></img></div>Ya

CSS

body {
    font-size: 14px;
}

img {
    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%;
}
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";