gpt4 book ai didi

html - 如何排列 4 个 div?

转载 作者:太空宇宙 更新时间:2023-11-04 11:19:03 27 4
gpt4 key购买 nike

我希望这些 div 是内联的。我试图将它们包装在一个 div 中并使用 display:inline-block;使它们排成一行但无法正常工作。我真的只是想了解定位和显示。任何帮助表示赞赏。

html

<div class="small_box_right">

</div>
<div class="small_box_right">

</div>
<div class="small_box_right">

</div>
<div class="small_box_right">

</div>

CSS

.small_box_right {
position: relative;
display:flex;
background: #CDCDB4;
border: 4px solid black;
height:300px;
width:300px;
}
.small_box_right:after, .small_box_right:before {
left: 100%;
top: 50%;
border: solid black;
content: " ";
height: ;
width: ;
position: absolute;
pointer-events: none;
}
.small_box_right:after {
border-color: rgba(136, 183, 213, 0);
border-left-color: #CDCDB4;;
border-width: 30px;
margin-top: -30px;
}
.small_box_right:before {
border-color: rgba(194, 225, 245, 0);
border-left-color:black ;
border-width: 36px;
margin-top: -36px;
}

最佳答案

这是一个DEMO

html:

<div class="box-cover">
<div class="small_box_right">

</div>
<div class="small_box_right">

</div>
<div class="small_box_right">

</div>
<div class="small_box_right">

</div>

</div>

CSS:

  .box-cover{
position: relative;
height: 300px;
overflow: auto;
width: 1550px;
}

.small_box_right {
position: relative;
display:inline-block;
background: #CDCDB4;
border: 4px solid black;
height:300px;
width:300px;
margin-right: 50px;
}
.small_box_right:after, .small_box_right:before {
left: 100%;
top: 50%;
border: solid black;
content: " ";
height: ;
width: ;
position: absolute;
pointer-events: none;
}
.small_box_right:after {
border-color: rgba(136, 183, 213, 0);
border-left-color: #CDCDB4;;
border-width: 30px;
margin-top: -30px;
}
.small_box_right:before {
border-color: rgba(194, 225, 245, 0);
border-left-color:black ;
border-width: 36px;
margin-top: -36px;
}

关于html - 如何排列 4 个 div?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/32947768/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com