How To Make Button Smaller

Topic summary

Goal: Reduce the size of a custom “dark mode” (candle) toggle button created via custom code.

What changed: Two approaches were provided to resize the button by editing theme CSS in Shopify.

How to implement:

  • Go to Online Store → Themes → Actions → Edit code → Assets.
  • Open base.css (or style.css/theme.css).
  • Add a rule targeting the image inside the dark mode button:
    • Option A: .darkmode-button img { height: 70px; width: 40px !important; }
    • Option B: .darkmode-button img { width: 25px !important; } (adjust value as needed)
  • Save. “!important” ensures the new size overrides existing styles.

Outcome: The original poster confirmed the first CSS solution worked, indicating the issue is resolved. Screenshots were shared to show the visual result but are not required to apply the fix.

Notes:

  • You can tweak width/height values to reach the desired size.
  • The selector .darkmode-button img specifically targets the image within the dark mode toggle.
Summarized with AI on December 31. AI used: gpt-5.

I had this custom code made for my site that inverts the site(dark mode) when you click it. I’m trying to improve my User Experience and want to make the candle smaller. I no longer communicate with the coder that created the code, so I’m lost how to find the size and change it on code. Please let me know

1 Like

Hi @cureblame

Check this one.

From your Shopify admin dashboard, click on “Online Store” and then “Themes”.

Find the theme that you want to edit and click on “Actions” and then “Edit code”.

In the “Assets” folder, click on “base.css, style.css or theme.css” file, depending on which file your theme uses to store its CSS styles. At the bottom of the file, add the following CSS code:

.darkmode-button img {
    height: 70px;
    width: 40px !important;
}

And Save.

Result:

Please don’t forget to Like and Mark Solution to the post that helped you. Thanks!

1 Like

Thanks, It worked. If you have the chance please check my latest post and let me know if you can help.

@cureblame Please follow below steps to make button smaller. Let me know whether it is helpful for you.

  1. From admin, go to “Online Store” → “Themes”.
  2. Click action button from the current theme and select “Edit code”.
  3. Search for “base.css” file and paste the below code at the bottom of the file.
.darkmode-button img {
    width: 25px !important;
}

Result will be like below,

NOTE: You can change the width as per your need.

Please provide your support by click “Like” and “Accepted” if our solution works for you. Thanks for your support.