Skip to main content

Insert css using Js

 Source code

function import_css(){
    var head = document.head;
    var style = document.createElement('link');
    style.rel = "stylesheet";
    style.id = "style";
    style.href = "./style.css";
    head.append(style);
}

Comments

Popular posts from this blog

Microsoft extension

 JSON file: {   "manifest_version" : 3 ,   "name" : "" ,   "version" : "0.1" ,   "author" : "" ,   "description" : "" ,   "icons" :{     "16" : "" ,     "48" : "" ,     "128" : ""   },   "action" : {     "default_title" : ".." ,     "default_icon" : {       "128" : ""     }   },   "content_scripts" :[     {       "matches" : [],       "js" : [ "script.js" ]     }   ] }

Chess Board

  Source code: html <! DOCTYPE html > < html lang = "en" > < head >     < meta charset = "UTF-8" >     < meta http-equiv = "X-UA-Compatible" content = "IE=edge" >     < meta name = "viewport" content = "width=device-width, initial-scale=1.0" >     < link rel = "stylesheet" href = "style.css" >     < title > Chess board </ title > </ head > < body >     < table >         < tr >             < th > ♖ </ th >             < th id = "black" > ♘ </ th >             < th id = "white" > ♗ </ th >             < th id = "black" > ♔ </ th >             < th id = "white" > ♕ </ th >           ...