如何设计一个重叠的按钮



[图像有设计][1]图像描述了我想要的设计。我尝试的是,我将三个按钮放在一起,并尝试将z索引,位置绝对,相对,但没有奏效。

https://i.stack.imgur.com/7OxFO.png

尝试过的代码是,我同时应用了三个按钮: 123

我得到的是看起来像这样的东西[这是我制作的图像] https://i.stack.imgur.com/ruxL5.png

请参阅此示例。家你得到了你想要的。 http://embed.plnkr.co/ExU03A42KNqr6XakFo4I/

<!DOCTYPE html>
<html>
<head>
    <link rel="stylesheet" href="style.css">
    <script src="script.js"></script>
  <style>
    button{
      width:120px;
      height:40px;
      margin:-5px;
      background:#ee5353;
      border:1px solid gray;
      border-radius:3px;
    }
    button:nth-child(2){
      height:60px;
      position:relative;z-index:2;
    }
  </style>
</head>
  <body>
   <button>1</button>
   <button>2</button>
   <button>3</button>
  </body>
</html>

最新更新