Use this template to inject your custom CSS onto a page
<all_urls>
(function() {
// ---- USER-DEFINED CSS ----
const userCSS = `
body {
background-color: #f0f0f0 !important;
}
.my-custom-class {
border: 2px solid red !important;
font-size: 18px !important;
}
`;
// ---------------------------
try {
// Check if a style tag with our ID already exists (avoid duplicates)
const styleId = "__injectjs_user_css__";
if (!document.getElementById(styleId)) {
const style = document.createElement("style");
style.id = styleId;
style.textContent = userCSS;
document.head.appendChild(style);
console.log("✅ InjectJS: User CSS injected.");
}
} catch (err) {
console.error("❌ InjectJS: Failed to inject CSS:", err);
}
})();Install requires the InjectJS Chrome extension. Scripts run only on sites matching the pattern above. Review code before installing any community script.