按钮高度不匹配

button heights not matching

我正在为我的大学课程制作一个网站,但我无法使幻灯片放映中的按钮高度匹配。我想知道是否有人可以告诉我如何让它们处于同一高度?

这是我的 css 幻灯片:

/=== 幻灯片部分 ===/

#container
{
    width: 90%;
    height: 700px;
    border: none;
    margin: 0 auto;
    position: relative;

}

#container > img
{
    width: 100%;
    height: 100%;
    position: absolute;
}

#container > .btn
{
    position: absolute;
    width: 50px;
    height: 50px;
    border: none;
    border-radius: 25px;
    top: 350px;
    background: #000000;
    color: #ffffff;
    font-size: 20px;
}

#container>#btn1:hover
{
    box-shadow: 10px 0px 20px 0px #343d46 ;
}
#container>#btn2:hover
{
    box-shadow: -10px 0px 20px 0px #343d46;
}

#container>#btn2
{
    position: relative;
    float: right;    
}

picture of the problem

尝试在#container>#btn2:

之前添加这个
#container>#btn1
{
 position: relative;
 float: left;    
}
change your

#container>#btn2
{
    position: relative;
    float: right;    
}  
to  
#container>#btn2
{
    right:0;    
}

绝对定位一般不应用于类(多个元素)。

我会删除您的 .btns 上的绝对定位并在您的容器上使用 flexbox,如下所示:-

#container
{
    width: 90%;
    height: 700px;
    border: none;
    margin: 0 auto;
    display: flex; /* adds flexbox to container */
    align-items: center; /* vertically aligns everything in container */
    justify-content: space-between; /* spaces the buttons as far away `enter code here`from each other as possible */
}

然后您可以向您的容器添加填充,以便更好地调整您的按钮与容器边缘的水平距离。