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日

悬赏问题

  • ¥20 西门子S7-Graph,S7-300,梯形图
  • ¥50 用易语言http 访问不了网页
  • ¥50 safari浏览器fetch提交数据后数据丢失问题
  • ¥15 matlab不知道怎么改,求解答!!
  • ¥15 永磁直线电机的电流环pi调不出来
  • ¥15 用stata实现聚类的代码
  • ¥15 请问paddlehub能支持移动端开发吗?在Android studio上该如何部署?
  • ¥20 docker里部署springboot项目,访问不到扬声器
  • ¥15 netty整合springboot之后自动重连失效
  • ¥15 悬赏!微信开发者工具报错,求帮改