Warning: file_get_contents(/data/phpspider/zhask/data//catemap/7/css/41.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Html flexbox边距导致溢出_Html_Css_Grid_Flexbox - Fatal编程技术网

Html flexbox边距导致溢出

Html flexbox边距导致溢出,html,css,grid,flexbox,Html,Css,Grid,Flexbox,我有一个flexbox溢出的小问题: html <div class="first"> <div class="child"></div> <div class="child"></div> <div class="child"></div> </div> 问题是,最后一个孩子是溢出的,为什么??我用盒子尺寸来框边盒子 如何在不

我有一个flexbox溢出的小问题:

html

<div class="first">
            <div class="child"></div>
            <div class="child"></div>
            <div class="child"></div>
</div>
问题是,最后一个孩子是溢出的,为什么??我用盒子尺寸来框边盒子

如何在不导致溢出的情况下在子级之间添加边距

我想这就是你想要做的:

*{
框大小:边框框;
}
身体{
利润率:50像素;
}
.首先{
显示器:flex;
flex-flow:行nowrap;
边框:1px纯绿色;
}
.孩子{
背景:红色;
边框:1px蓝色实心;
高度:10px;
弯曲:1;/*等宽*/
右边距:10px;
}
.第一:最后一个孩子{
右边距:0;
}


框大小调整
对页边距没有影响!你想做什么?那么,如何在不造成溢出的情况下在子级之间添加边距呢
* {
    box-sizing: border-box;
}

body {
    margin: 50px;
}
.first {
    display: flex;
    flex-flow: row nowrap;
}

.child {
    background: red;
    border: 1px blue solid;
    height: 10px;
    flex: 0 0 33.3%;

    margin-right: 10px;
}

.first :last-child {
    flex: 0 0 33.4%;
}