I'm looking to place images next to each other within the same div. I've been able to draw the images successfully, but I am struggling with positioning them side by side.
Each time I draw an image, it is placed in the same div.
This is my HTML structure:
<div id="thumbnailImages">
<canvas
id="thumbnailImage"
/>
</div>
Here is the code snippet:
function thumbnail(video) {
const canvasThumbnail = document.getElementById('thumbnailImage')
const cth = canvasThumbnail.getContext('2d')
const data = video.slice(8)
imgToHTML(data, e => {
const drawingThumbnail = new Image()
drawingThumbnail.src = e.target.result
drawingThumbnail.onload = function () {
canvasThumbnail.width = 128
canvasThumbnail.height = 128
cth.drawImage(drawingThumbnail, 0, 0)
document.getElementById('thumbnails').appendChild(canvasThumbnail)
}
})
}
I want to have multiple 'canvas' elements within the 'thumbnailImages' ID. Can you offer any assistance?