Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

Like this: https://stackoverflow.com/questions/15505225/inject-css-styl...

  var node = document.createElement('style');
  node.innerHTML = '* { outline: 2px dotted orangered; };
  document.body.appendChild(node);


This should suffice, no need to make a variable, this can all be done at once:

   document.head.appendChild(document.createElement('style')).textContent = '* { outline: 2px dotted orangered'




Consider applying for YC's Fall 2026 batch! Applications are open till July 27.

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: