I was writing a Google Chrome extension to insert an image into the body of a website. It currently does that, but the image is centered all the way at the bottom, after the text of the website. I was wondering how to put it in the top left instead, or to use coordinates for the location. This is my code currently in JavaScript, as I can't use CSS for it.
function imageappend() {
const img = document.createElement("img");
img.src = chrome.runtime.getURL("imageedit_1_3932659157.png");
img.style.top = "0";
img.style.left = "0";
img.style.padding = "0";
img.style.margin = "0";
document.body.appendChild(img);
}
let [tab] = await chrome.tabs.query({ active: true, currentWindow: true });
chrome.scripting.executeScript({
target: { tabId: tab.id },
function: imageappend
});
})(); ```