How to make a bone shaped button

后端 未结 4 1207
面向向阳花
面向向阳花 2021-02-12 11:56

I am currently experimenting on a button for my website. I want it to look like an average button but, once you hover it, it becomes a bone (my website is about dogs).

S

4条回答
  •  遥遥无期
    2021-02-12 12:30

    Try this: Bone Button

    :root {
      --bg: #1a1e24;
      --color: #eee;
      --font: Montserrat, Roboto, Helvetica, Arial, sans-serif;
    }
    
    .wrapper {
      padding: 1.5rem 0;
      filter: url('#goo');
    }
    
    .bone {
      display: inline-block;
      text-align: center;
      background: var(--color);
      color: var(--bg);
      font-weight: bold;
      padding: 0.8em 0.5em 0.8em;
      line-height: 1;
      border-radius: 0.4em;
      position: relative;
      min-width: 8.23em;
      text-decoration: none;
      font-family: var(--font);
      font-size: 1.25rem;
    }
    
    .bone::before,
    .bone::after,
    .bone span::before,
    .bone span::after {
      width: 2.3em;
      height: 2.3em;
      position: absolute;
      content: "";
      display: inline-block;
      background: var(--color);
      border-radius: 50%;
      transition: transform 1s ease;
      transform: scale(0);
      z-index: -1;
    }
    
    .bone::before {
      top: 50%;
      right: -10%;
    }
    
    .bone::after {
      bottom: 50%;
      right: -10%;
    }
    
    .bone span::before {
      top: 50%;
      left: -10%;
    }
    
    .bone span::after {
      bottom: 50%;
      left: -10%;
    }
    
    .bone:hover::before,
    .bone:hover::after,
    .bone:hover span::before,
    .bone:hover span::after {
      transform: none;
    }
    
    
    /* Demo styles */
    
    body {
      width: 100%;
      height: 100%;
      min-height: 100vh;
      display: flex;
      justify-content: center;
      align-items: center;
      background: var(--bg)
    }
    
    
    
    
        
                
                
                
            
        
    

提交回复
热议问题