HTML/CSS 中的按钮溢出

问题描述 投票:0回答:1

我有一个问题,按钮从容器中溢出。我尝试在 YouTube 上查找,我在按钮中添加了

width: 100%
,但没有任何帮助。

body{
    height: 100vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    background: lightgray;
}

.container {
    display: flex;
    flex-direction: column;
    text-align: center;
    gap: 35px;
    width: 500px;
    padding: 60px;
    background: #fff;
    border: 2px solid #DBDBDB;
    border-radius: 20px;
}



.socialLogin {
    display: flex;
    justify-content: center;
    gap: 10px;
}

.socialLogin > button {
    padding: 10px 70px;
}
<div class="container">
    <div class="socialLogin">
        <button><a href="#"><img src="./assets/apple.png"></a></button>
        <button><a href="#"><img src="./assets/facebook.png"></a></button>
        <button><a href="#"><img src="./assets/google.png"></a></button>
    </div>
</div>

enter image description here

html css flexbox
1个回答
0
投票

您正在设置容器类的宽度,将其删除,它将起作用

© www.soinside.com 2019 - 2024. All rights reserved.