我有一个div(.videos1),其中包括2个divs(.test和.test1)。我想使用margin-left / right:0px删除这2个div之间的空间;但是它不起作用,可能是因为浮动。我需要在中心留出2个div,并留出一些空间。
HTML:
>>> def foo(x):
... def bar(y):
... return x + y
... return bar
...
>>> foo(3)(5)
8
CSS:
<div class="videos1">
<div class="test"><img src="img1.jpg"></div><div class="test1"><img src="img2.jpg"></div>
</div>
答案 0 :(得分:0)
Flexbox可以做到这一点。
.flex {
display: flex;
justify-content: center;
background: #eee;
width: 100%;
}
.box1, .box2 {
width: 200px;
height: 150px;
background: red;
}
.box2 {
margin-left: 20px;
background: orange;
}
<div class="flex">
<div class="box1"></div>
<div class="box2"></div>
</div>