Skip to content

Instantly share code, notes, and snippets.

@erickarbe
Created April 11, 2022 15:29
Show Gist options
  • Save erickarbe/44e8145899d0476d2c6c164282ef37b2 to your computer and use it in GitHub Desktop.
Save erickarbe/44e8145899d0476d2c6c164282ef37b2 to your computer and use it in GitHub Desktop.
How to add custom css to a square website
<script>
var parentWindow = window.parent;
// Create our stylesheet
var style = parentWindow.document.createElement('style');
style.innerHTML = `#YOUR_SELECTOR_HERE {max-width: 100% !important; padding: 0; overflow: hidden; }`;
// Get the first script tag
var ref = parentWindow.document.querySelector('script');
// Insert our new styles before the first script tag
ref.parentNode.insertBefore(style, ref);
</script>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment