0

I'm setting up Shoppy on my website but I don't like the embed style. Is there a way to change the CSS from my code?

<script src="https://shoppy.gg/api/embed.js"></script>
<button data-shoppy-product="PRODUCT ID">Pay</button>
twnty
  • 9
  • 2
  • You can just add it to your style sheet – Vince Aug 21 '19 at 13:10
  • How? What do I have to insert in my CSS file? Thanks :D – twnty Aug 21 '19 at 13:11
  • yes, include you own css file, lets call it theme.css as an example. inside theme.css you target the element you need to customize. – Vince Aug 21 '19 at 13:14
  • Ok for example I have embed--header element. The bg color now is #1c2260 and I want to set to #000. When I do .embed--header {background: #000; } nothing change... – twnty Aug 21 '19 at 13:17
  • Make sure your css loads after the script. if the element style is applied at runtime, you can overwrite the style programatically – Vince Aug 21 '19 at 13:20
  • How can I do that? Sorry I am a noobie >:/ – twnty Aug 21 '19 at 13:21
  • document.getElementsByClassName("embed--header")[0].style.backgroundColor = "#000"; – Vince Aug 21 '19 at 13:25
  • It is still not working :( Can you please try to edit it? – twnty Aug 21 '19 at 13:30
  • Please provide a snippet, you do not have enough information to give you a concrete solution – Vince Aug 21 '19 at 13:33
  • https://pastebin.com/GvVLe8ah – twnty Aug 21 '19 at 13:39
  • I dont see an element with the class "embed--header" – Vince Aug 21 '19 at 13:45
  • Run the file in the browser, press the pay button and inspect the blue element (Also can you please contact me on Discord to make it easier? twenty#6325) – twnty Aug 21 '19 at 13:49
  • I see, the content is rendered in an iframe, check here: https://stackoverflow.com/questions/217776/how-to-apply-css-to-iframe – Vince Aug 21 '19 at 13:57
  • I don't know how to insert all of that stuff in my html file... can you please help me? Oh and thank you so much for your patience – twnty Aug 21 '19 at 14:01

1 Answers1

-1

You have to include your own CSS file and have to overwrite the default CSS. You can overwrite the default CSS by adding a class selector with the default class selector in your CSS file and write your own CSS. For example, if the default CSS is,

.embed--header {
  background: #1c2260;
 }

then you can overwrite like this:

.embed--header.changebackground {
  background: #000;
 }

Be sure to give the class name as "changebackground" to your element, otherwise nothing change will happen.

Abhishek Kumar
  • 332
  • 3
  • 15