FairyTalesss 2023-03-20 11:20 采纳率: 78.6%
浏览 23
已结题

Html横向排列元素间出现间隔

制作横向排列的若干个div元素时,元素相邻处出现意料外的间隔。

<div class="wrapper">
        <div class="slider">
            <div class="testimonial">
                <p>This is testimonial 1</p>
                <button>Button 1</button>
            </div>
            <div class="testimonial">
                <p>This is testimonial 2</p>
                <button>Button 2</button>
            </div>
            <div class="testimonial">
                <p>This is testimonial 3</p>
                <button>Button 3</button>
            </div>
            <div class="testimonial">
                <p>This is testimonial 4</p>
                <button>Button 4</button>
            </div>
            <div class="testimonial">
                <p>This is testimonial 5</p>
                <button>Button 5</button>
            </div>
        </div>    
    </div>

body{
    display: flex;
    min-height: 100vh;
    justify-content: center;
    align-items: center;
}

.wrapper{
    width: 100%;
    overflow: hidden;
    
}

.slider{
    width: 100%;
    white-space: nowrap;
    overflow: hidden;
}

.testimonial{
    background-color: #ededed;
    display: inline-flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    width: 650px;
    height: 130px;
}

img

  • 写回答

1条回答 默认 最新

  • 简效 2023-03-20 11:32
    关注

    .slider{font-size:0}

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

问题事件

  • 系统已结题 3月28日
  • 已采纳回答 3月20日
  • 创建了问题 3月20日

悬赏问题

  • ¥15 Vue3 大型图片数据拖动排序
  • ¥15 划分vlan后不通了
  • ¥15 GDI处理通道视频时总是带有白色锯齿
  • ¥20 用雷电模拟器安装百达屋apk一直闪退
  • ¥15 算能科技20240506咨询(拒绝大模型回答)
  • ¥15 自适应 AR 模型 参数估计Matlab程序
  • ¥100 角动量包络面如何用MATLAB绘制
  • ¥15 merge函数占用内存过大
  • ¥15 使用EMD去噪处理RML2016数据集时候的原理
  • ¥15 神经网络预测均方误差很小 但是图像上看着差别太大