Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Inject css into exsisting web page [closed]

Tags:

javascript

css

I am trying to modify the CSS of a website where I don't have access to change the css.

I am developing some custom templates for a company that is using the 3rd party software 'Inksoft', which allows the creation of stores and also includes a design studio for designing your own t-shirts, etc.

The templates they provide are not the greatest, so I want to modify the css to make them a little better. There are places I can insert html, so I can use JavaScript. Someone mentioned possibly using a setTimeout.

Here is an example of a page created using one of their templates: http://stores.inksoft.com/Trevor_Friedrich/

Anyone have any ideas? Thanks in advance!

like image 304
MoonandFox Avatar asked Feb 13 '26 15:02

MoonandFox


1 Answers

http://jsfiddle.net/wkCnb/ you can definitely use JavaScript to add CSS to your page.

HTML

<div>test</div>

JavaScript on DOMReady

var cssText = "div { background-color: black; color: white;}";
var css = document.createElement("style");
css.type = "text/css";
if("textContent" in css)
    css.textContent = cssText;
else
    css.innerText = cssText;
document.body.appendChild(css);
like image 190
Louis Ricci Avatar answered Feb 16 '26 04:02

Louis Ricci



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!