White border around button + animation

Solved

White border around button + animation

silenceclothing
Explorer
132 0 17

hello. I want to make this button transparent with a white border around + an animation that starts on hover so the button starts to fill white smooth from left to right. Can someone please help me with this?

silenceclothing_0-1736940386189.png

 

Accepted Solution (1)
websensepro
Shopify Partner
2114 264 313

This is an accepted solution.

Hi @silenceclothing 

@silenceclothing 

1. Go to Online Store -> Theme -> Edit code.
2. Open your theme.liquid file
3. In theme.liquid, paste the below code before </head>

<style>
a.button.button--primary:hover {
    color: black !important;
}
a.button.button--primary {
    position: relative;
    color: black;
    background: transparent;
    border: 3px solid white;
    overflow: hidden;
}
a.button.button--primary::after, a.button.button--primary::before {
    content: " ";
    display: block;
    position: absolute;
    width: 100%;
    top: 0;
    bottom: 0;
    right: 0;
    background: #ffff !important;
    z-index: -1;
}
a.button.button--primary::before {
    transform: translateX(-100%);
}
a.button.button--primary:hover:before {
  transform: translateX(0);
  transition: transform 350ms ease;
}
a.button.button--primary::after {
   z-index: 0;
  transform: translateX(100%);
  transition: none;
  transition: transform 350ms ease;
}
a.button.button--primary:hover:after {
  opacity: 1;
  transform: translateX(0);
 transition: transform 350ms 360ms ease;
}
</style>

 

If my reply is helpful, kindly click like and mark it as an accepted solution.
Thanks!
Use our Big Bulk Discount app to boost your sales! 🚀 (https://apps.shopify.com/big-bulk-discount). Easy to set up and perfect for attracting more customers with bulk discounts. Try it now and watch your revenue grow!

 

Need a Shopify developer? Hire us at WebSensePro For Shopify Design Changes/Coding
For Free Tutorials Subscribe to our youtube
Get More Sales Using Big Bulk Discount APP
Create Your Shopify Store For Just 1$/Month
Get More Sales Using Big Bulk Discount APP

View solution in original post

Replies 29 (29)

websensepro
Shopify Partner
2114 264 313

Hi @silenceclothing , kindly provide your store URL please and if it is password protected, please share the password as well. Thanks

Need a Shopify developer? Hire us at WebSensePro For Shopify Design Changes/Coding
For Free Tutorials Subscribe to our youtube
Get More Sales Using Big Bulk Discount APP
Create Your Shopify Store For Just 1$/Month
Get More Sales Using Big Bulk Discount APP

rajweb
Shopify Partner
827 71 157

Hello @silenceclothing ,

Could you please share your store URL and password so I can continue assisting you?

Best Regards,

Rajat

Rajat | Shopify Expert Developer
Need a reliable Shopify developer for your next project?
Our App: Productify Groups App
Email: rajat.shopify@gmail.com
Portfolio: https://rajatweb.dev
rajweb
Shopify Partner
827 71 157

To achieve the transparent button with a white border and the smooth left-to-right fill animation on hover, you can use the following CSS:

.button--primary {
    background-color: transparent;
    color: white;
    border: 2px solid white;
    position: relative;
    overflow: hidden;
    transition: all 0.4s ease;
}

.button--primary::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: white;
    transform: scaleX(0);
    transform-origin: bottom right;
    transition: transform 0.4s ease;
}

.button--primary:hover::before {
    transform: scaleX(1);
    transform-origin: bottom left;
}

.button--primary:hover {
    color: black; /* Change text color on hover if desired */
    border-color: black; /* Change border color if desired */
}

This should give you the desired button effect. Just add this CSS to your theme's stylesheet or custom CSS section, and it should work!

Rajat | Shopify Expert Developer
Need a reliable Shopify developer for your next project?
Our App: Productify Groups App
Email: rajat.shopify@gmail.com
Portfolio: https://rajatweb.dev
rajweb
Shopify Partner
827 71 157

@silenceclothing ,

You can add the CSS:

Follow these Steps:

1. Online Store

2. Themes 

3. Edit Code

4. Click on theme.css.liquid or styles.css.liquid (depending on your theme) under the Assets folder to open the CSS file.

5.  Paste the provided CSS at the end of the file

Thanks

 

Rajat | Shopify Expert Developer
Need a reliable Shopify developer for your next project?
Our App: Productify Groups App
Email: rajat.shopify@gmail.com
Portfolio: https://rajatweb.dev
silenceclothing
Explorer
132 0 17

Hello. 

My custom css option in theme editor is full. Is there a other place i can insert the code?

rajweb
Shopify Partner
827 71 157

You can add the CSS by following these steps:

- Go to Online Store -> Themes -> Edit code.

- Open theme.liquid. Paste the CSS code before the </head> tag.

Save the changes.

Thanks

Rajat | Shopify Expert Developer
Need a reliable Shopify developer for your next project?
Our App: Productify Groups App
Email: rajat.shopify@gmail.com
Portfolio: https://rajatweb.dev
silenceclothing
Explorer
132 0 17

did not work. this text comes in the top?

silenceclothing_0-1736941910532.png

 

silenceclothing
Explorer
132 0 17

websensepro
Shopify Partner
2114 264 313

@silenceclothing 

1. Go to Online Store -> Theme -> Edit code.
2. Open your theme.liquid file
3. In theme.liquid, paste the below code before </head>

<style>
.banner__buttons {
    border: 2px solid #ffff !important;
    background: transparent !important;
}
</style>

If my reply is helpful, kindly click like and mark it as an accepted solution.
Thanks!
Use our Big Bulk Discount app to boost your sales! 🚀 (https://apps.shopify.com/big-bulk-discount). Easy to set up and perfect for attracting more customers with bulk discounts. Try it now and watch your revenue grow!

 

 

 

Need a Shopify developer? Hire us at WebSensePro For Shopify Design Changes/Coding
For Free Tutorials Subscribe to our youtube
Get More Sales Using Big Bulk Discount APP
Create Your Shopify Store For Just 1$/Month
Get More Sales Using Big Bulk Discount APP
silenceclothing
Explorer
132 0 17

Hello, and thanks for the reply!

It made the button have a white border, but i also want a animation that makes the button starts to fill from left to right when hover, can you do that?

silenceclothing_0-1736941236221.png

 

Ahmad31
Shopify Partner
224 21 37

@silenceclothing change your button html first like this:

<a role="link" aria-disabled="true" class="button">
  <span class="text">Knappetikett</span>
</a>

then apply style code :

.text {
  display: inline-block;
  position: relative;
  transform: translateX(0);
  transition: transform 0s ease-in-out, opacity 0s ease-in-out;
}

.button:hover .text {
  opacity: 0; /* Hide text */
  transform: translateX(-100%); /* Move text to the left */
  transition: opacity 0.1s ease-in-out, transform 0.1s ease-in-out;
  animation: slide-in 0.3s ease-in-out 0.1s forwards; /* Slide text in after 0.1s */
}

@keyframes slide-in {
  from {
    transform: translateX(100%);
    opacity: 0;
  }
  to {
    transform: translateX(0);
    opacity: 1;
  }
}

these changes apply animation on button text hover, moves text from left to right on hover 

Love my work? Buy Me A Coffee
Hire Me: Email me Or Chat on Whatsapp
If you found my solution helpful, please like and accept it. Your support is greatly appreciated!
silenceclothing
Explorer
132 0 17

where do i replace my button html? and where do i insert the other code?

also i dont mean the text to move on hover. in mean the text to go from transparent to start filling with color.. 

for refference, go to : notresucces.com

silenceclothing
Explorer
132 0 17
silenceclothing
Explorer
132 0 17
silenceclothing
Explorer
132 0 17
websensepro
Shopify Partner
2114 264 313

This is an accepted solution.

Hi @silenceclothing 

@silenceclothing 

1. Go to Online Store -> Theme -> Edit code.
2. Open your theme.liquid file
3. In theme.liquid, paste the below code before </head>

<style>
a.button.button--primary:hover {
    color: black !important;
}
a.button.button--primary {
    position: relative;
    color: black;
    background: transparent;
    border: 3px solid white;
    overflow: hidden;
}
a.button.button--primary::after, a.button.button--primary::before {
    content: " ";
    display: block;
    position: absolute;
    width: 100%;
    top: 0;
    bottom: 0;
    right: 0;
    background: #ffff !important;
    z-index: -1;
}
a.button.button--primary::before {
    transform: translateX(-100%);
}
a.button.button--primary:hover:before {
  transform: translateX(0);
  transition: transform 350ms ease;
}
a.button.button--primary::after {
   z-index: 0;
  transform: translateX(100%);
  transition: none;
  transition: transform 350ms ease;
}
a.button.button--primary:hover:after {
  opacity: 1;
  transform: translateX(0);
 transition: transform 350ms 360ms ease;
}
</style>

 

If my reply is helpful, kindly click like and mark it as an accepted solution.
Thanks!
Use our Big Bulk Discount app to boost your sales! 🚀 (https://apps.shopify.com/big-bulk-discount). Easy to set up and perfect for attracting more customers with bulk discounts. Try it now and watch your revenue grow!

 

Need a Shopify developer? Hire us at WebSensePro For Shopify Design Changes/Coding
For Free Tutorials Subscribe to our youtube
Get More Sales Using Big Bulk Discount APP
Create Your Shopify Store For Just 1$/Month
Get More Sales Using Big Bulk Discount APP
silenceclothing
Explorer
132 0 17

thanks, after the button is filled, ist starts adding a layer bak to the left so it removes the text. Is it possible to make it stop doing this. So it just stays colored after fully button is filled? also, how do i make the border and text inside fully white?

websensepro
Shopify Partner
2114 264 313

@silenceclothing 

1. Go to Online Store -> Theme -> Edit code.
2. Open your theme.liquid file
3. In theme.liquid, paste the below code before </head>

<style>
a.button.button--primary::after, a.button.button--primary::before {
    z-index: -1 !important;
}
</style>

 

If my reply is helpful, kindly click like and mark it as an accepted solution.
Thanks!
Use our Big Bulk Discount app to boost your sales! 🚀 (https://apps.shopify.com/big-bulk-discount). Easy to set up and perfect for attracting more customers with bulk discounts. Try it now and watch your revenue grow!

 

Need a Shopify developer? Hire us at WebSensePro For Shopify Design Changes/Coding
For Free Tutorials Subscribe to our youtube
Get More Sales Using Big Bulk Discount APP
Create Your Shopify Store For Just 1$/Month
Get More Sales Using Big Bulk Discount APP
silenceclothing
Explorer
132 0 17

i need the text to turn from white to black when the button starts filling white.

websensepro
Shopify Partner
2114 264 313

1. Go to Online Store -> Theme -> Edit code.
2. Open your theme.liquid file
3. In theme.liquid, paste the below code before </head>

<style>
a.button.button--primary {
    color: #ffff !important;
}
a.button.button--primary:hover {
    color: black !important;
}
</style>

 

If my reply is helpful, kindly click like and mark it as an accepted solution.
Thanks!
Use our Big Bulk Discount app to boost your sales! 🚀 (https://apps.shopify.com/big-bulk-discount). Easy to set up and perfect for attracting more customers with bulk discounts. Try it now and watch your revenue grow!

 

Need a Shopify developer? Hire us at WebSensePro For Shopify Design Changes/Coding
For Free Tutorials Subscribe to our youtube
Get More Sales Using Big Bulk Discount APP
Create Your Shopify Store For Just 1$/Month
Get More Sales Using Big Bulk Discount APP
silenceclothing
Explorer
132 0 17

And remove the first code i added ?

websensepro
Shopify Partner
2114 264 313

No 

Need a Shopify developer? Hire us at WebSensePro For Shopify Design Changes/Coding
For Free Tutorials Subscribe to our youtube
Get More Sales Using Big Bulk Discount APP
Create Your Shopify Store For Just 1$/Month
Get More Sales Using Big Bulk Discount APP
silenceclothing
Explorer
132 0 17

why is the border and text grey/transparent and not fully white? also, why is there a black line that goes fron and back inside the button?

silenceclothing
Explorer
132 0 17

dmwwebartisan
Shopify Partner
12376 2559 3749

@silenceclothing 

Please provide your store URL If your store is password protected then share the storefront password also.

Thanks!

If helpful then please Like and Accept Solution | Email: dmw.webartisan@gmail.com |  Instagram: @dmw.webartisan
PageFly App to customize your pages | The most powerful Shopify page builder app
dmwwebartisan
Shopify Partner
12376 2559 3749

@silenceclothing 

Please add the following code to your assets/base.css bottom of the file.

.banner__buttons .button:before {
    box-shadow: none !important;
    border: 1px solid #fff !important;
    color: #fff !important;
}

.banner__buttons .button:after {
    box-shadow: none !important;
    border: 1px solid #fff !important;
    color: #fff !important;
}

 .banner__buttons .button[aria-disabled='true'] {
cursor: not-allowed;
    opacity: 1 !important;
}

Thanks!

If helpful then please Like and Accept Solution | Email: dmw.webartisan@gmail.com |  Instagram: @dmw.webartisan
PageFly App to customize your pages | The most powerful Shopify page builder app

silenceclothing
Explorer
132 0 17

@DaisyVo do you know how?