Matt Laszcz
Matt Laszcz

Reputation: 409

CSS Drop Shadow effect not displaying correctly

I am creating a button with a drop shadow effect (neumorphism) but when I apply my CSS to the button is just appears as a 2 toned solid button...Which part of the CSS am I using incorrectly? Are my drop shadow values wrong relative to the size of the button? Changing the width and height doesn't help.

.css-test {
  background: #EAF0F8;
  mix-blend-mode: normal;
  border: 0.5px solid #FFFFFF;
  box-shadow: 0px -30px 60px rgba(167, 179, 190, 0.35), 0px 30px 60px rgba(167, 179, 190, 0.35);
  border-radius: 35px;
}

.buysellbutton {
    width: 44px;
    height: 44px;
    background: #F0F0F3;
    box-shadow: -10px -10px 30px 40% #FFFFFF, 10px 10px 30px rgba(174, 174, 192, 0.4);
    border-radius: 16px;
  }
<div class="css-test">
   <h3> Cash Flow: <span>CSS TEST</span></h3>
   <button class="buysellbutton">buy</button>
</div>

Upvotes: 4

Views: 578

Answers (2)

shotgun02
shotgun02

Reputation: 784

to remove black border from button just add broder-style:none to button. Added one more button with hover and active styling.

for creating Neumorphism effect you can check https://neumorphism.io/

.css-test {
  background: #EAF0F8;
  mix-blend-mode: normal;
  border: 0.5px solid #FFFFFF;
  box-shadow: 0px -30px 60px rgba(167, 179, 190, 0.35), 0px 30px 60px rgba(167, 179, 190, 0.35);
  border-radius: 15px;
  padding: 10px;
}

.buysellbutton {
    width: 80px;
    height: 44px;   
    border-style:none;         
    border-radius: 16px;
    background: #F0F0F3;
    box-shadow:  18px 18px 36px #c5c5c7, 
             -18px -18px 36px #ffffff;
    outline:none;
         
  }
  
  
  .button {
    width: 150px;
    height: 50px;
    background: #f3f0f1;
    position: relative;
    background: #f3f0f1;
    margin-bottom: 25px;
    border-radius: 32px;
    text-align: center;
    cursor: pointer;
    transition: all 0.1s ease-in-out;
    outline: none;
    border-style: none;
    box-shadow: -6px -6px 10px rgba(255, 255, 255, 0.8),
        6px 6px 10px rgba(0, 0, 0, 0.2);
    color: #6f6cde;
    }
    span {
      font-size: 25px;
      font-weight: semibold;
    }
      .button:hover {
        opacity: 0.7;
        box-shadow: -6px -6px 10px rgba(255, 255, 255, 0.8),
          6px 6px 10px rgba(0, 0, 0, 0.2);
      }
      .button:active {
        opacity: 1;
        box-shadow: inset -4px -4px 8px rgba(255, 255, 255, 0.5),
          inset 8px 8px 16px rgba(0, 0, 0, 0.1);
        color: #79e3b6;
      }
<div class="css-test">
   <h3> Cash Flow: <span>CSS TEST</span></h3>
   <button class="buysellbutton">buy</button>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
   <button class="button"><span>Buy</span></button>
</div>

Upvotes: 3

Darwin
Darwin

Reputation: 2047

First, use the below code at the top of all CSS

button{
   all: unset;
}

and instead of

box-shadow: -10px -10px 30px 40% #FFFFFF, 10px 10px 30px rgba(174, 174, 192, 0.4);

use

box-shadow: -10px -10px 30px 40px #FFFFFF, 10px 10px 30px rgba(174, 174, 192, 0.4);

Upvotes: 0

Related Questions