简体   繁体   中英

position this element I created with JavaScript Chrome Extension

CODE

function createButton(){
    var newEl = document.createElement("header");
    var r = document.createTextNode("My Chrome Extension");
    newEl.appendChild(r);
    document.body.appendChild(newEl);
}

createButton();

So I just learned how to create an element in JavaScript but the element spawns at the bottom left corner of the screen so how do I position it???

You can move your elements around using it's css properties :

How to position a DIV in a specific coordinates?

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM