Jump to content

Creating custom buttons with CSS (Everything went wrong)

Recommended Posts

I am trying to make a custom button for my website. Website: https://www.ecoflame.ca/
The buttons I am tempering with are on the landing page of the website.

Here's the CSS code I am trying to inject:
https://uiverse.io/shah1345/spicy-liger-32

I am replacing all ".button2" with .sqs-block-button-element--medium sqs-button-element--primary sqs-block-button-element

OR simply ".sqs-block-button-element"
The result is janky. The resulting button shows the current and the intended hover effect at the same time. 

I am using the "Custom CSS" menu to do that. What am I doing wrong here?

Link to comment
  • Replies 1
  • Views 333
  • Created
  • Last Reply

Top Posters In This Topic

Top Posters In This Topic

Because some SS core code overrides your code. You need to add !important to some attributes to override these code. Use this new code

.button-block a {
  display: inline-block;
  transition: all 0.2s ease-in;
  position: relative;
  overflow: hidden;
  z-index: 1;
  color: #090909;
  padding: 0.7em 1.7em;
  font-size: 18px;
  border-radius: 0.5em;
  background: #e8e8e8;
  border: 1px solid #e8e8e8;
  box-shadow: 6px 6px 12px #c5c5c5,
             -6px -6px 12px #ffffff;
}

.button-block a:active {
  color: #666;
  box-shadow: inset 4px 4px 12px #c5c5c5,
             inset -4px -4px 12px #ffffff;
}

.button-block a:before {
  content: "";
  position: absolute !important;
  left: 50% !important;
  transform: translateX(-50%) scaleY(1) scaleX(1.25) !important;
  top: 100% !important;
  width: 140%;
  height: 180%;
  background-color: rgba(0, 0, 0, 0.05) !important;
  border-radius: 50% !important;
  display: block;
  transition: all 0.5s 0.1s cubic-bezier(0.55, 0, 0.1, 1);
  z-index: -1 !important;
}

.button-block a:after {
  content: "";
  position: absolute;
  left: 55%;
  transform: translateX(-50%) scaleY(1) scaleX(1.45);
  top: 180%;
  width: 160%;
  height: 190%;
  background-color: #009087;
  border-radius: 50%;
  display: block;
  transition: all 0.5s 0.1s cubic-bezier(0.55, 0, 0.1, 1);
  z-index: -1;
}

.button-block a:hover {
  color: #ffffff;
  border: 1px solid #009087;
}

.button-block a:hover:before {
  top: -35%;
  background-color: #009087;
  transform: translateX(-50%) scaleY(1.3) scaleX(0.8);
}

.button-block a:hover:after {
  top: -45%;
  background-color: #009087;
  transform: translateX(-50%) scaleY(1.3) scaleX(0.8);
}

 

Email me if you have need any help (free, of course.). Answer within 24 hours. 
Or send to forum message

Contact Customer Care - Learn CSS - Buy me a coffee (thank you!)

Link to comment

Create an account or sign in to comment

You need to be a member in order to leave a comment


×
×
  • Create New...

Squarespace Webinars

Free online sessions where you’ll learn the basics and refine your Squarespace skills.

Hire a Designer

Stand out online with the help of an experienced designer or developer.