使用 CSS 将圆形加号按钮悬停时动画为药丸形状

0 html css animation

我有一个圆形按钮,里面有一个加号图标。悬停时,圆圈会变成药丸形状。

我想实现两件事:

  1. 悬停时将加号图标移至左侧。
  2. 文本(如阅读更多)从右侧淡入,同时停在药丸形状的中间。

我能够顺利地将圆圈动画化为药丸形状,但我无法控制加号图标(它移动到药丸形状的中间而不是向左移动)。我也不知道如何添加文本。

谢谢

    .My-circle-Button { width: 50px; height: 50px; border-radius: 25px; 
    background: none; transition: width .5s ease; color:#000; border: 4px solid 
    #000; }

    .My-circle-Button:after { content: "+"; font-size: 2.6em; line-height: 
    37px;}

    .My-circle-Button:hover { width: 240px;}
Run Code Online (Sandbox Code Playgroud)
<button class="My-circle-Button"></button>
Run Code Online (Sandbox Code Playgroud)

<button class="My-circle-Button"></button>
Run Code Online (Sandbox Code Playgroud)

Anm*_*dal 5

请查看这个片段。

.My-circle-Button { width: 50px; height: 50px; border-radius: 25px; 
background: none; transition: width .5s ease; color:#000; border: 4px solid 
#000; position: relative; padding-left: 30px; color: #000; overflow: hidden; text-align: center;}
.My-circle-Button span { white-space: nowrap; transition: all ease .3s; opacity: 0; font-size: 16px; line-height: 20px; transition: all ease .3s;}
.My-circle-Button:after { content: "+";
    font-size: 2.6em;
  height: 50px;
    left: 13px;
    position: absolute;
    top: 0;
    bottom: 0; }

.My-circle-Button:hover { width: 240px;}
.My-circle-Button:hover span{ opacity: 1; transition-delay:.3s;  transition: all ease .3s; }
Run Code Online (Sandbox Code Playgroud)
<button class="My-circle-Button"><span>Read More</span></button>
Run Code Online (Sandbox Code Playgroud)