为什么我的 div 元素不能正常生长?

Why are my div elements not growing properly?

我试图将社交网络的元素放在一起,当我将鼠标悬停在每个元素上时,它会增长到 200 像素的大小。我写了所有的代码,但是当鼠标放在元素上时,元素没有正常增长,看起来像一个椭圆。有没有人可以帮我解决这个问题?

<style>
:root {
  --color-orange: #ff6600;
  --color-green: #22d122;
  --color-cyan: #33ffff;
  --color-magenta: #f33192;
  --color-white: #ffffff;
  --color-blue: #166fd4;
  --color-magenta-dark:#831a4e;
  --color-gray:#d6d6d6;
  --color-red:#ff0000;
  --color-graydark:#333;
  --color-blue-dark:#103d68;
}
* {
  padding: 0;
  margin: 0;
  box-sizing: border-box;
  font-family: "Nunito", sans-serif;
}
.wrapper {
  display: grid;
  grid-template-columns: repeat(4, auto);
  place-content: center;
  width: 100%;
  height: 100vh;
  background-color: var(--color-gray);
}
.button {
  display: inline-block;
  background-color: var(--color-white);
  width: 60px;
  height: 60px;
  overflow: hidden;
  box-shadow: 0 10px 10px rgba(0,0,0,0.1);
  transition: all 0.3s ease-out;
  border-radius: 50%;
  margin: 0 5px;
  cursor: pointer;
}
.button:hover {
  width: 200px;
}
.button .icon {
  display: inline-block;
  text-align: center;
  font-size: 20px;
  border-radius: 50%;
  height: 60px;
  width: 60px;
  line-height: 60px;
  transition: all 0.3s ease-out;
}
.button:hover .icon i {
  color: var(--color-white);
}
.button:nth-child(1):hover .icon {
  background-color: var(--color-blue-dark);
}
.button:nth-child(2):hover .icon {
  background-color: var(--color-blue);
}
.button:nth-child(3):hover .icon {
  background-color: var(--color-magenta);
}
.button:nth-child(4):hover .icon {
  background-color: var(--color-red);
}
.button span {
  font-size: 20px;
  font-weight: bold;
  margin-left: 10px;
}
.button:nth-child(1) span {
  color: var(--color-blue-dark);
}
.button:nth-child(2) span {
  color: var(--color-blue);
}
.button:nth-child(3) span {
  color: var(--color-magenta);
}
.button:nth-child(4) span {
  color: var(--color-red);
}
</style>
<div class="wrapper">
    <div class="button">
        <div class="icon">
            <i class="fab fa-facebook-f"></i>
        </div>
        <span>Facebook</span>
    </div>
    <div class="button">
        <div class="icon">
            <i class="fab fa-twitter"></i>
        </div>
        <span>Twitter</span>
    </div>
    <div class="button">
        <div class="icon">
            <i class="fab fa-instagram"></i>
        </div>
        <span>Instagram</span>
    </div>
    <div class="button">
        <div class="icon">
            <i class="fab fa-youtube"></i>
        </div>
        <span>Youtube</span>
    </div>
</div>

当您将鼠标悬停在按钮上时,它的高度会增加,宽度会增加

.button:hover{
transform:scale(1.015deg)
}

.button:hover

上更改 border-radius 的值

:root {
  --color-orange: #ff6600;
  --color-green: #22d122;
  --color-cyan: #33ffff;
  --color-magenta: #f33192;
  --color-white: #ffffff;
  --color-blue: #166fd4;
  --color-magenta-dark: #831a4e;
  --color-gray: #d6d6d6;
  --color-red: #ff0000;
  --color-graydark: #333;
  --color-blue-dark: #103d68;
}

* {
  padding: 0;
  margin: 0;
  box-sizing: border-box;
  font-family: "Nunito", sans-serif;
}

.wrapper {
  display: grid;
  grid-template-columns: repeat(4, auto);
  place-content: center;
  width: 100%;
  height: 100vh;
  background-color: var(--color-gray);
}

.button {
  display: inline-block;
  background-color: var(--color-white);
  width: 60px;
  height: 60px;
  overflow: hidden;
  box-shadow: 0 10px 10px rgba(0, 0, 0, 0.1);
  transition: all 0.3s ease-out;
  border-radius: 50%;
  margin: 0 5px;
  cursor: pointer;
}

.button:hover {
  width: 200px;
  border-radius: 50px;
}

.button .icon {
  display: inline-block;
  text-align: center;
  font-size: 20px;
  border-radius: 50%;
  height: 60px;
  width: 60px;
  line-height: 60px;
  transition: all 0.3s ease-out;
}

.button:hover .icon i {
  color: var(--color-white);
}

.button:nth-child(1):hover .icon {
  background-color: var(--color-blue-dark);
}

.button:nth-child(2):hover .icon {
  background-color: var(--color-blue);
}

.button:nth-child(3):hover .icon {
  background-color: var(--color-magenta);
}

.button:nth-child(4):hover .icon {
  background-color: var(--color-red);
}

.button span {
  font-size: 20px;
  font-weight: bold;
  margin-left: 10px;
}

.button:nth-child(1) span {
  color: var(--color-blue-dark);
}

.button:nth-child(2) span {
  color: var(--color-blue);
}

.button:nth-child(3) span {
  color: var(--color-magenta);
}

.button:nth-child(4) span {
  color: var(--color-red);
}
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.1.0/css/all.min.css">
<div class="wrapper">
  <div class="button">
    <div class="icon">
      <i class="fab fa-facebook-f"></i>
    </div>
    <span>Facebook</span>
  </div>
  <div class="button">
    <div class="icon">
      <i class="fab fa-twitter"></i>
    </div>
    <span>Twitter</span>
  </div>
  <div class="button">
    <div class="icon">
      <i class="fab fa-instagram"></i>
    </div>
    <span>Instagram</span>
  </div>
  <div class="button">
    <div class="icon">
      <i class="fab fa-youtube"></i>
    </div>
    <span>Youtube</span>
  </div>
</div>

您还需要更改悬停时的高度。

.button:hover {
   width: 200px;
   height: 200px;
   border-radius: 50px;
}

但如果您追求性能,我建议您使用transform: scale(2)