gpt4 book ai didi

html - 将 div 保留在 Container 中

转载 作者:行者123 更新时间:2023-11-28 02:30:52 26 4
gpt4 key购买 nike

我有下面的代码片段,如果您查看它,您会发现最低级别的元素在容器之外。

我知道它是因为 position:absolute;转换:翻译(-33%)。但这是迄今为止我能够将元素置于父元素下方的唯一方法。

是否有某种方法可以将最低的 3 个元素“放入”容器中并使整个元素能够从左向右滚动?

body {
background-color: #eaeaea;
width: 2000px
}

.CB {
background-color: #c4cfd8;
width: 1200px;
margin: 0 auto;
margin-top: 50px;
user-select: none;
white-space: nowrap;
overflow-x: auto;
overflow-y: hidden;
min-height: 200vh;
}

.CB .CB_Menu {
width: 100%;
height: 35px;
background-color: #fff;
margin-bottom: 20px;
}

.CB .CB_Content .Products,
.CB .CB_Content .Parts {
text-align: center;
}

.CB .CB_Content .Products > div,
.CB .CB_Content .Parts > div {
display: inline-block;
}

.CB .CB_Content .Products > div > div,
.CB .CB_Content .Parts > div > div {
display: inline-table;
}

.CB .CB_Content .Products .Product,
.CB .CB_Content .Parts .Product,
.CB .CB_Content .Products .Part,
.CB .CB_Content .Parts .Part {
width: 200px;
height: 200px;
background-color: #fff;
margin: 0 10px;
display: inline-table;
border-radius: 5px;
position: relative;
}

.CB .CB_Content .Products .Product .Product_Header,
.CB .CB_Content .Parts .Product .Product_Header,
.CB .CB_Content .Products .Part .Product_Header,
.CB .CB_Content .Parts .Part .Product_Header,
.CB .CB_Content .Products .Product .Part_Header,
.CB .CB_Content .Parts .Product .Part_Header,
.CB .CB_Content .Products .Part .Part_Header,
.CB .CB_Content .Parts .Part .Part_Header {
background-color: #eaeaea;
width: 100%;
text-align: left;
border-top-left-radius: 5px;
border-top-right-radius: 5px;
}

.CB .CB_Content .Products .Product .Product_Header span,
.CB .CB_Content .Parts .Product .Product_Header span,
.CB .CB_Content .Products .Part .Product_Header span,
.CB .CB_Content .Parts .Part .Product_Header span,
.CB .CB_Content .Products .Product .Part_Header span,
.CB .CB_Content .Parts .Product .Part_Header span,
.CB .CB_Content .Products .Part .Part_Header span,
.CB .CB_Content .Parts .Part .Part_Header span {
font-size: 16px;
}

.CB .CB_Content .Products .Product .Product_Header span a,
.CB .CB_Content .Parts .Product .Product_Header span a,
.CB .CB_Content .Products .Part .Product_Header span a,
.CB .CB_Content .Parts .Part .Product_Header span a,
.CB .CB_Content .Products .Product .Part_Header span a,
.CB .CB_Content .Parts .Product .Part_Header span a,
.CB .CB_Content .Products .Part .Part_Header span a,
.CB .CB_Content .Parts .Part .Part_Header span a {
float: right;
color: #000;
}

.CB .CB_Content .Products .Product .Product_Content,
.CB .CB_Content .Parts .Product .Product_Content,
.CB .CB_Content .Products .Part .Product_Content,
.CB .CB_Content .Parts .Part .Product_Content,
.CB .CB_Content .Products .Product .Part_Content,
.CB .CB_Content .Parts .Product .Part_Content,
.CB .CB_Content .Products .Part .Part_Content,
.CB .CB_Content .Parts .Part .Part_Content {
text-align: left;
}

.CB .CB_Content .Products .Product .Product_Content .Product_Content_Left,
.CB .CB_Content .Parts .Product .Product_Content .Product_Content_Left,
.CB .CB_Content .Products .Part .Product_Content .Product_Content_Left,
.CB .CB_Content .Parts .Part .Product_Content .Product_Content_Left,
.CB .CB_Content .Products .Product .Part_Content .Product_Content_Left,
.CB .CB_Content .Parts .Product .Part_Content .Product_Content_Left,
.CB .CB_Content .Products .Part .Part_Content .Product_Content_Left,
.CB .CB_Content .Parts .Part .Part_Content .Product_Content_Left,
.CB .CB_Content .Products .Product .Product_Content .Part_Content_Left,
.CB .CB_Content .Parts .Product .Product_Content .Part_Content_Left,
.CB .CB_Content .Products .Part .Product_Content .Part_Content_Left,
.CB .CB_Content .Parts .Part .Product_Content .Part_Content_Left,
.CB .CB_Content .Products .Product .Part_Content .Part_Content_Left,
.CB .CB_Content .Parts .Product .Part_Content .Part_Content_Left,
.CB .CB_Content .Products .Part .Part_Content .Part_Content_Left,
.CB .CB_Content .Parts .Part .Part_Content .Part_Content_Left {
width: 50%;
min-height: 120px;
float: left;
}

.CB .CB_Content .Products .Product .Product_Content .Product_Content_Left a,
.CB .CB_Content .Parts .Product .Product_Content .Product_Content_Left a,
.CB .CB_Content .Products .Part .Product_Content .Product_Content_Left a,
.CB .CB_Content .Parts .Part .Product_Content .Product_Content_Left a,
.CB .CB_Content .Products .Product .Part_Content .Product_Content_Left a,
.CB .CB_Content .Parts .Product .Part_Content .Product_Content_Left a,
.CB .CB_Content .Products .Part .Part_Content .Product_Content_Left a,
.CB .CB_Content .Parts .Part .Part_Content .Product_Content_Left a,
.CB .CB_Content .Products .Product .Product_Content .Part_Content_Left a,
.CB .CB_Content .Parts .Product .Product_Content .Part_Content_Left a,
.CB .CB_Content .Products .Part .Product_Content .Part_Content_Left a,
.CB .CB_Content .Parts .Part .Product_Content .Part_Content_Left a,
.CB .CB_Content .Products .Product .Part_Content .Part_Content_Left a,
.CB .CB_Content .Parts .Product .Part_Content .Part_Content_Left a,
.CB .CB_Content .Products .Part .Part_Content .Part_Content_Left a,
.CB .CB_Content .Parts .Part .Part_Content .Part_Content_Left a {
display: block;
color: #000;
}

.CB .CB_Content .Products .Product .Product_Content .Product_Content_right,
.CB .CB_Content .Parts .Product .Product_Content .Product_Content_right,
.CB .CB_Content .Products .Part .Product_Content .Product_Content_right,
.CB .CB_Content .Parts .Part .Product_Content .Product_Content_right,
.CB .CB_Content .Products .Product .Part_Content .Product_Content_right,
.CB .CB_Content .Parts .Product .Part_Content .Product_Content_right,
.CB .CB_Content .Products .Part .Part_Content .Product_Content_right,
.CB .CB_Content .Parts .Part .Part_Content .Product_Content_right,
.CB .CB_Content .Products .Product .Product_Content .Part_Content_right,
.CB .CB_Content .Parts .Product .Product_Content .Part_Content_right,
.CB .CB_Content .Products .Part .Product_Content .Part_Content_right,
.CB .CB_Content .Parts .Part .Product_Content .Part_Content_right,
.CB .CB_Content .Products .Product .Part_Content .Part_Content_right,
.CB .CB_Content .Parts .Product .Part_Content .Part_Content_right,
.CB .CB_Content .Products .Part .Part_Content .Part_Content_right,
.CB .CB_Content .Parts .Part .Part_Content .Part_Content_right {
width: 50%;
min-height: 120px;
}

.CB .CB_Content .Products .Product .Product_Content .Product_Content_right img,
.CB .CB_Content .Parts .Product .Product_Content .Product_Content_right img,
.CB .CB_Content .Products .Part .Product_Content .Product_Content_right img,
.CB .CB_Content .Parts .Part .Product_Content .Product_Content_right img,
.CB .CB_Content .Products .Product .Part_Content .Product_Content_right img,
.CB .CB_Content .Parts .Product .Part_Content .Product_Content_right img,
.CB .CB_Content .Products .Part .Part_Content .Product_Content_right img,
.CB .CB_Content .Parts .Part .Part_Content .Product_Content_right img,
.CB .CB_Content .Products .Product .Product_Content .Part_Content_right img,
.CB .CB_Content .Parts .Product .Product_Content .Part_Content_right img,
.CB .CB_Content .Products .Part .Product_Content .Part_Content_right img,
.CB .CB_Content .Parts .Part .Product_Content .Part_Content_right img,
.CB .CB_Content .Products .Product .Part_Content .Part_Content_right img,
.CB .CB_Content .Parts .Product .Part_Content .Part_Content_right img,
.CB .CB_Content .Products .Part .Part_Content .Part_Content_right img,
.CB .CB_Content .Parts .Part .Part_Content .Part_Content_right img {
width: 100%;
}

.CB .CB_Content .Products .Product .Product_Footer,
.CB .CB_Content .Parts .Product .Product_Footer,
.CB .CB_Content .Products .Part .Product_Footer,
.CB .CB_Content .Parts .Part .Product_Footer,
.CB .CB_Content .Products .Product .Part_Footer,
.CB .CB_Content .Parts .Product .Part_Footer,
.CB .CB_Content .Products .Part .Part_Footer,
.CB .CB_Content .Parts .Part .Part_Footer {
position: absolute;
bottom: 0;
display: flex;
width: 100%;
align-items: center;
justify-content: center;
}

.CB .CB_Content .Products .Product .Product_Footer a,
.CB .CB_Content .Parts .Product .Product_Footer a,
.CB .CB_Content .Products .Part .Product_Footer a,
.CB .CB_Content .Parts .Part .Product_Footer a,
.CB .CB_Content .Products .Product .Part_Footer a,
.CB .CB_Content .Parts .Product .Part_Footer a,
.CB .CB_Content .Products .Part .Part_Footer a,
.CB .CB_Content .Parts .Part .Part_Footer a {
width: 50%;
height: 25px;
border: 1px solid #dddddd;
background-color: #eaeaea;
border-radius: 5px;
margin-bottom: 10px;
line-height: 25px;
color: #000;
}

.CB .CB_Content .Products .Product .Product_Footer button,
.CB .CB_Content .Parts .Product .Product_Footer button,
.CB .CB_Content .Products .Part .Product_Footer button,
.CB .CB_Content .Parts .Part .Product_Footer button,
.CB .CB_Content .Products .Product .Part_Footer button,
.CB .CB_Content .Parts .Product .Part_Footer button,
.CB .CB_Content .Products .Part .Part_Footer button,
.CB .CB_Content .Parts .Part .Part_Footer button {
width: 50%;
height: 25px;
border: 1px solid #dddddd;
background-color: #eaeaea;
border-radius: 5px;
margin-bottom: 10px;
padding: 4px 6px;
color: #000;
}

.CB .CB_Content .lineTop {
height: 25px;
width: calc(100% - 25%);
border-top: 1px dotted #fff;
border-right: 1px dotted #fff;
border-left: 1px dotted #fff;
margin: 0 110px;
display: none;
}

.CB .CB_Content .lineTop.active {
display: block;
}

.CB .CB_Content .lineTop.none {
border-right: none;
width: 1px;
margin-top: -2px;
}

.CB .CB_Content .lineTop.two {
width: calc(100% - 50%);
}

.CB .CB_Content .lineTop .LineTop_Line {
width: 219px;
height: 100%;
border-right: 1px dotted #fff;
float: left;
}

.CB .CB_Content .lineBottom {
display: none;
height: 25px;
width: 100%;
}

.CB .CB_Content .lineBottom.active {
display: block;
}

.CB .CB_Content .lineBottom .LineBottom_Line {
width: 50%;
height: 100%;
border-right: 1px dotted #fff;
}

.CB .CB_Content .lineBottom .LineBottom_Line.Test {
width: calc(50% - 300px);
}
<div class="CB">

<div class="CB_Menu">
header
</div>

<div class="CB_Content">

<div class="Products">
<div>
<div class="Product">
<div class="Product_Header">
<span>Title<a href="#"><i class="fa fa-ellipsis-h"></i></a></span>
</div>
<div class="Product_Content">
<div class="Product_Content_Left">
<a href="#">Link 1</a>
<a href="#">Link 2</a>
</div>
<div class="Product_Content_right">
<img src="https://www.maltbazaren.dk/images/staal-300x300-t.png" />
</div>
</div>
<div class="Product_Footer">
<button>Show <i class="fa fa-caret-down"></i></button>
</div>
</div>
<div class="lineBottom active">
<div class="LineBottom_Line"></div>
</div>
</div>
</div>
<div class="Parts">
<div>
<div class="lineTop active">
<div class="LineTop_Line"></div>
<div class="LineTop_Line"></div>
</div>
<div>
<div class="Part">
<div class="Part_Header">
<span>Title<a href="#"><i class="fa fa-ellipsis-h"></i></a></span>
</div>
<div class="Part_Content">
<div class="Part_Content_Left">
<a href="#">Link 1</a>
<a href="#">Link 2</a>
</div>
<div class="Part_Content_right">
<img src="https://www.maltbazaren.dk/images/staal-300x300-t.png" />
</div>
</div>
<div class="Part_Footer">
<button>Show <i class="fa fa-caret-down"></i></button>
</div>
</div>

<div style="position:absolute; transform:translate(-33%)">
<div class="lineBottom active">
<div class="LineBottom_Line"></div>
</div>

<div class="sub_part">
<div class="lineTop active">
<div class="LineTop_Line"></div>
</div>
<div class="Parts">
<div>
<div class="Part">
<div class="Part_Header">
<span>Title<a href="#"><i class="fa fa-ellipsis-h"></i></a></span>
</div>
<div class="Part_Content">
<div class="Part_Content_Left">
<a href="#">Link 1</a>
<a href="#">Link 2</a>
</div>
<div class="Part_Content_right">
<img src="https://www.maltbazaren.dk/images/staal-300x300-t.png" />
</div>
</div>
<div class="Part_Footer">
<button>Show <i class="fa fa-caret-down"></i></button>
</div>
</div>
<div class="Part">
<div class="Part_Header">
<span>Title<a href="#"><i class="fa fa-ellipsis-h"></i></a></span>
</div>
<div class="Part_Content">
<div class="Part_Content_Left">
<a href="#">Link 1</a>
<a href="#">Link 2</a>
</div>
<div class="Part_Content_right">
<img src="https://www.maltbazaren.dk/images/staal-300x300-t.png" />
</div>
</div>
<div class="Part_Footer">
<button>Show <i class="fa fa-caret-down"></i></button>
</div>
</div>
<div class="Part">
<div class="Part_Header">
<span>Title<a href="#"><i class="fa fa-ellipsis-h"></i></a></span>
</div>
<div class="Part_Content">
<div class="Part_Content_Left">
<a href="#">Link 1</a>
<a href="#">Link 2</a>
</div>
<div class="Part_Content_right">
<img src="https://www.maltbazaren.dk/images/staal-300x300-t.png" />
</div>
</div>
<div class="Part_Footer">
<button>Show <i class="fa fa-caret-down"></i></button>
</div>
</div>
</div>
</div>
</div>
</div>

</div>
<div class="Part">
<div class="Part_Header">
<span>Title<a href="#"><i class="fa fa-ellipsis-h"></i></a></span>
</div>
<div class="Part_Content">
<div class="Part_Content_Left">
<a href="#">Link 1</a>
<a href="#">Link 2</a>
</div>
<div class="Part_Content_right">
<img src="https://www.maltbazaren.dk/images/staal-300x300-t.png" />
</div>
</div>
<div class="Part_Footer">
<button>Show <i class="fa fa-caret-down"></i></button>
</div>
</div>
<div class="Part">
<div class="Part_Header">
<span>Title<a href="#"><i class="fa fa-ellipsis-h"></i></a></span>
</div>
<div class="Part_Content">
<div class="Part_Content_Left">
<a href="#">Link 1</a>
<a href="#">Link 2</a>
</div>
<div class="Part_Content_right">
<img src="https://www.maltbazaren.dk/images/staal-300x300-t.png" />
</div>
</div>
<div class="Part_Footer">
<button>Show <i class="fa fa-caret-down"></i></button>
</div>
</div>
<div class="Part">
<div class="Part_Header">
<span>Title<a href="#"><i class="fa fa-ellipsis-h"></i></a></span>
</div>
<div class="Part_Content">
<div class="Part_Content_Left">
<a href="#">Link 1</a>
<a href="#">Link 2</a>
</div>
<div class="Part_Content_right">
<img src="https://www.maltbazaren.dk/images/staal-300x300-t.png" />
</div>
</div>
<div class="Part_Footer">
<button>Show <i class="fa fa-caret-down"></i></button>
</div>
</div>

</div>
</div>
</div>
</div>

最佳答案

您正在努力实现这一目标吗?您必须做出的更改:

  • 移除 body 的固定宽度,即 width:2000px。
  • 移除 CB 类的固定宽度,即 width:1200px。

您可以将宽度设置为自动或保留它们,它们将根据需要水平扩展。

body {
background-color: #eaeaea;
}

.CB {
background-color: #c4cfd8;
width: auto;
margin: 0 auto;
margin-top: 50px;
user-select: none;
white-space: nowrap;
overflow-x: auto;
overflow-y: hidden;
min-height: 200vh;
}

.CB .CB_Menu {
width: 100%;
height: 35px;
background-color: #fff;
margin-bottom: 20px;
}

.CB .CB_Content .Products,
.CB .CB_Content .Parts {
text-align: center;
}

.CB .CB_Content .Products > div,
.CB .CB_Content .Parts > div {
display: inline-block;
}

.CB .CB_Content .Products > div > div,
.CB .CB_Content .Parts > div > div {
display: inline-table;
}

.CB .CB_Content .Products .Product,
.CB .CB_Content .Parts .Product,
.CB .CB_Content .Products .Part,
.CB .CB_Content .Parts .Part {
width: 200px;
height: 200px;
background-color: #fff;
margin: 0 10px;
display: inline-table;
border-radius: 5px;
position: relative;
}

.CB .CB_Content .Products .Product .Product_Header,
.CB .CB_Content .Parts .Product .Product_Header,
.CB .CB_Content .Products .Part .Product_Header,
.CB .CB_Content .Parts .Part .Product_Header,
.CB .CB_Content .Products .Product .Part_Header,
.CB .CB_Content .Parts .Product .Part_Header,
.CB .CB_Content .Products .Part .Part_Header,
.CB .CB_Content .Parts .Part .Part_Header {
background-color: #eaeaea;
width: 100%;
text-align: left;
border-top-left-radius: 5px;
border-top-right-radius: 5px;
}

.CB .CB_Content .Products .Product .Product_Header span,
.CB .CB_Content .Parts .Product .Product_Header span,
.CB .CB_Content .Products .Part .Product_Header span,
.CB .CB_Content .Parts .Part .Product_Header span,
.CB .CB_Content .Products .Product .Part_Header span,
.CB .CB_Content .Parts .Product .Part_Header span,
.CB .CB_Content .Products .Part .Part_Header span,
.CB .CB_Content .Parts .Part .Part_Header span {
font-size: 16px;
}

.CB .CB_Content .Products .Product .Product_Header span a,
.CB .CB_Content .Parts .Product .Product_Header span a,
.CB .CB_Content .Products .Part .Product_Header span a,
.CB .CB_Content .Parts .Part .Product_Header span a,
.CB .CB_Content .Products .Product .Part_Header span a,
.CB .CB_Content .Parts .Product .Part_Header span a,
.CB .CB_Content .Products .Part .Part_Header span a,
.CB .CB_Content .Parts .Part .Part_Header span a {
float: right;
color: #000;
}

.CB .CB_Content .Products .Product .Product_Content,
.CB .CB_Content .Parts .Product .Product_Content,
.CB .CB_Content .Products .Part .Product_Content,
.CB .CB_Content .Parts .Part .Product_Content,
.CB .CB_Content .Products .Product .Part_Content,
.CB .CB_Content .Parts .Product .Part_Content,
.CB .CB_Content .Products .Part .Part_Content,
.CB .CB_Content .Parts .Part .Part_Content {
text-align: left;
}

.CB .CB_Content .Products .Product .Product_Content .Product_Content_Left,
.CB .CB_Content .Parts .Product .Product_Content .Product_Content_Left,
.CB .CB_Content .Products .Part .Product_Content .Product_Content_Left,
.CB .CB_Content .Parts .Part .Product_Content .Product_Content_Left,
.CB .CB_Content .Products .Product .Part_Content .Product_Content_Left,
.CB .CB_Content .Parts .Product .Part_Content .Product_Content_Left,
.CB .CB_Content .Products .Part .Part_Content .Product_Content_Left,
.CB .CB_Content .Parts .Part .Part_Content .Product_Content_Left,
.CB .CB_Content .Products .Product .Product_Content .Part_Content_Left,
.CB .CB_Content .Parts .Product .Product_Content .Part_Content_Left,
.CB .CB_Content .Products .Part .Product_Content .Part_Content_Left,
.CB .CB_Content .Parts .Part .Product_Content .Part_Content_Left,
.CB .CB_Content .Products .Product .Part_Content .Part_Content_Left,
.CB .CB_Content .Parts .Product .Part_Content .Part_Content_Left,
.CB .CB_Content .Products .Part .Part_Content .Part_Content_Left,
.CB .CB_Content .Parts .Part .Part_Content .Part_Content_Left {
width: 50%;
min-height: 120px;
float: left;
}

.CB .CB_Content .Products .Product .Product_Content .Product_Content_Left a,
.CB .CB_Content .Parts .Product .Product_Content .Product_Content_Left a,
.CB .CB_Content .Products .Part .Product_Content .Product_Content_Left a,
.CB .CB_Content .Parts .Part .Product_Content .Product_Content_Left a,
.CB .CB_Content .Products .Product .Part_Content .Product_Content_Left a,
.CB .CB_Content .Parts .Product .Part_Content .Product_Content_Left a,
.CB .CB_Content .Products .Part .Part_Content .Product_Content_Left a,
.CB .CB_Content .Parts .Part .Part_Content .Product_Content_Left a,
.CB .CB_Content .Products .Product .Product_Content .Part_Content_Left a,
.CB .CB_Content .Parts .Product .Product_Content .Part_Content_Left a,
.CB .CB_Content .Products .Part .Product_Content .Part_Content_Left a,
.CB .CB_Content .Parts .Part .Product_Content .Part_Content_Left a,
.CB .CB_Content .Products .Product .Part_Content .Part_Content_Left a,
.CB .CB_Content .Parts .Product .Part_Content .Part_Content_Left a,
.CB .CB_Content .Products .Part .Part_Content .Part_Content_Left a,
.CB .CB_Content .Parts .Part .Part_Content .Part_Content_Left a {
display: block;
color: #000;
}

.CB .CB_Content .Products .Product .Product_Content .Product_Content_right,
.CB .CB_Content .Parts .Product .Product_Content .Product_Content_right,
.CB .CB_Content .Products .Part .Product_Content .Product_Content_right,
.CB .CB_Content .Parts .Part .Product_Content .Product_Content_right,
.CB .CB_Content .Products .Product .Part_Content .Product_Content_right,
.CB .CB_Content .Parts .Product .Part_Content .Product_Content_right,
.CB .CB_Content .Products .Part .Part_Content .Product_Content_right,
.CB .CB_Content .Parts .Part .Part_Content .Product_Content_right,
.CB .CB_Content .Products .Product .Product_Content .Part_Content_right,
.CB .CB_Content .Parts .Product .Product_Content .Part_Content_right,
.CB .CB_Content .Products .Part .Product_Content .Part_Content_right,
.CB .CB_Content .Parts .Part .Product_Content .Part_Content_right,
.CB .CB_Content .Products .Product .Part_Content .Part_Content_right,
.CB .CB_Content .Parts .Product .Part_Content .Part_Content_right,
.CB .CB_Content .Products .Part .Part_Content .Part_Content_right,
.CB .CB_Content .Parts .Part .Part_Content .Part_Content_right {
width: 50%;
min-height: 120px;
}

.CB .CB_Content .Products .Product .Product_Content .Product_Content_right img,
.CB .CB_Content .Parts .Product .Product_Content .Product_Content_right img,
.CB .CB_Content .Products .Part .Product_Content .Product_Content_right img,
.CB .CB_Content .Parts .Part .Product_Content .Product_Content_right img,
.CB .CB_Content .Products .Product .Part_Content .Product_Content_right img,
.CB .CB_Content .Parts .Product .Part_Content .Product_Content_right img,
.CB .CB_Content .Products .Part .Part_Content .Product_Content_right img,
.CB .CB_Content .Parts .Part .Part_Content .Product_Content_right img,
.CB .CB_Content .Products .Product .Product_Content .Part_Content_right img,
.CB .CB_Content .Parts .Product .Product_Content .Part_Content_right img,
.CB .CB_Content .Products .Part .Product_Content .Part_Content_right img,
.CB .CB_Content .Parts .Part .Product_Content .Part_Content_right img,
.CB .CB_Content .Products .Product .Part_Content .Part_Content_right img,
.CB .CB_Content .Parts .Product .Part_Content .Part_Content_right img,
.CB .CB_Content .Products .Part .Part_Content .Part_Content_right img,
.CB .CB_Content .Parts .Part .Part_Content .Part_Content_right img {
width: 100%;
}

.CB .CB_Content .Products .Product .Product_Footer,
.CB .CB_Content .Parts .Product .Product_Footer,
.CB .CB_Content .Products .Part .Product_Footer,
.CB .CB_Content .Parts .Part .Product_Footer,
.CB .CB_Content .Products .Product .Part_Footer,
.CB .CB_Content .Parts .Product .Part_Footer,
.CB .CB_Content .Products .Part .Part_Footer,
.CB .CB_Content .Parts .Part .Part_Footer {
position: absolute;
bottom: 0;
display: flex;
width: 100%;
align-items: center;
justify-content: center;
}

.CB .CB_Content .Products .Product .Product_Footer a,
.CB .CB_Content .Parts .Product .Product_Footer a,
.CB .CB_Content .Products .Part .Product_Footer a,
.CB .CB_Content .Parts .Part .Product_Footer a,
.CB .CB_Content .Products .Product .Part_Footer a,
.CB .CB_Content .Parts .Product .Part_Footer a,
.CB .CB_Content .Products .Part .Part_Footer a,
.CB .CB_Content .Parts .Part .Part_Footer a {
width: 50%;
height: 25px;
border: 1px solid #dddddd;
background-color: #eaeaea;
border-radius: 5px;
margin-bottom: 10px;
line-height: 25px;
color: #000;
}

.CB .CB_Content .Products .Product .Product_Footer button,
.CB .CB_Content .Parts .Product .Product_Footer button,
.CB .CB_Content .Products .Part .Product_Footer button,
.CB .CB_Content .Parts .Part .Product_Footer button,
.CB .CB_Content .Products .Product .Part_Footer button,
.CB .CB_Content .Parts .Product .Part_Footer button,
.CB .CB_Content .Products .Part .Part_Footer button,
.CB .CB_Content .Parts .Part .Part_Footer button {
width: 50%;
height: 25px;
border: 1px solid #dddddd;
background-color: #eaeaea;
border-radius: 5px;
margin-bottom: 10px;
padding: 4px 6px;
color: #000;
}

.CB .CB_Content .lineTop {
height: 25px;
width: calc(100% - 25%);
border-top: 1px dotted #fff;
border-right: 1px dotted #fff;
border-left: 1px dotted #fff;
margin: 0 110px;
display: none;
}

.CB .CB_Content .lineTop.active {
display: block;
}

.CB .CB_Content .lineTop.none {
border-right: none;
width: 1px;
margin-top: -2px;
}

.CB .CB_Content .lineTop.two {
width: calc(100% - 50%);
}

.CB .CB_Content .lineTop .LineTop_Line {
width: 219px;
height: 100%;
border-right: 1px dotted #fff;
float: left;
}

.CB .CB_Content .lineBottom {
display: none;
height: 25px;
width: 100%;
}

.CB .CB_Content .lineBottom.active {
display: block;
}

.CB .CB_Content .lineBottom .LineBottom_Line {
width: 50%;
height: 100%;
border-right: 1px dotted #fff;
}

.CB .CB_Content .lineBottom .LineBottom_Line.Test {
width: calc(50% - 300px);
}
<div class="CB">

<div class="CB_Menu">
header
</div>

<div class="CB_Content">

<div class="Products">
<div>
<div class="Product">
<div class="Product_Header">
<span>Title<a href="#"><i class="fa fa-ellipsis-h"></i></a></span>
</div>
<div class="Product_Content">
<div class="Product_Content_Left">
<a href="#">Link 1</a>
<a href="#">Link 2</a>
</div>
<div class="Product_Content_right">
<img src="https://www.maltbazaren.dk/images/staal-300x300-t.png" />
</div>
</div>
<div class="Product_Footer">
<button>Show <i class="fa fa-caret-down"></i></button>
</div>
</div>
<div class="lineBottom active">
<div class="LineBottom_Line"></div>
</div>
</div>
</div>
<div class="Parts">
<div>
<div class="lineTop active">
<div class="LineTop_Line"></div>
<div class="LineTop_Line"></div>
</div>
<div>
<div class="Part">
<div class="Part_Header">
<span>Title<a href="#"><i class="fa fa-ellipsis-h"></i></a></span>
</div>
<div class="Part_Content">
<div class="Part_Content_Left">
<a href="#">Link 1</a>
<a href="#">Link 2</a>
</div>
<div class="Part_Content_right">
<img src="https://www.maltbazaren.dk/images/staal-300x300-t.png" />
</div>
</div>
<div class="Part_Footer">
<button>Show <i class="fa fa-caret-down"></i></button>
</div>
</div>

<div style="position:absolute; transform:translate(-33%)">
<div class="lineBottom active">
<div class="LineBottom_Line"></div>
</div>

<div class="sub_part">
<div class="lineTop active">
<div class="LineTop_Line"></div>
</div>
<div class="Parts">
<div>
<div class="Part">
<div class="Part_Header">
<span>Title<a href="#"><i class="fa fa-ellipsis-h"></i></a></span>
</div>
<div class="Part_Content">
<div class="Part_Content_Left">
<a href="#">Link 1</a>
<a href="#">Link 2</a>
</div>
<div class="Part_Content_right">
<img src="https://www.maltbazaren.dk/images/staal-300x300-t.png" />
</div>
</div>
<div class="Part_Footer">
<button>Show <i class="fa fa-caret-down"></i></button>
</div>
</div>
<div class="Part">
<div class="Part_Header">
<span>Title<a href="#"><i class="fa fa-ellipsis-h"></i></a></span>
</div>
<div class="Part_Content">
<div class="Part_Content_Left">
<a href="#">Link 1</a>
<a href="#">Link 2</a>
</div>
<div class="Part_Content_right">
<img src="https://www.maltbazaren.dk/images/staal-300x300-t.png" />
</div>
</div>
<div class="Part_Footer">
<button>Show <i class="fa fa-caret-down"></i></button>
</div>
</div>
<div class="Part">
<div class="Part_Header">
<span>Title<a href="#"><i class="fa fa-ellipsis-h"></i></a></span>
</div>
<div class="Part_Content">
<div class="Part_Content_Left">
<a href="#">Link 1</a>
<a href="#">Link 2</a>
</div>
<div class="Part_Content_right">
<img src="https://www.maltbazaren.dk/images/staal-300x300-t.png" />
</div>
</div>
<div class="Part_Footer">
<button>Show <i class="fa fa-caret-down"></i></button>
</div>
</div>
</div>
</div>
</div>
</div>

</div>
<div class="Part">
<div class="Part_Header">
<span>Title<a href="#"><i class="fa fa-ellipsis-h"></i></a></span>
</div>
<div class="Part_Content">
<div class="Part_Content_Left">
<a href="#">Link 1</a>
<a href="#">Link 2</a>
</div>
<div class="Part_Content_right">
<img src="https://www.maltbazaren.dk/images/staal-300x300-t.png" />
</div>
</div>
<div class="Part_Footer">
<button>Show <i class="fa fa-caret-down"></i></button>
</div>
</div>
<div class="Part">
<div class="Part_Header">
<span>Title<a href="#"><i class="fa fa-ellipsis-h"></i></a></span>
</div>
<div class="Part_Content">
<div class="Part_Content_Left">
<a href="#">Link 1</a>
<a href="#">Link 2</a>
</div>
<div class="Part_Content_right">
<img src="https://www.maltbazaren.dk/images/staal-300x300-t.png" />
</div>
</div>
<div class="Part_Footer">
<button>Show <i class="fa fa-caret-down"></i></button>
</div>
</div>
<div class="Part">
<div class="Part_Header">
<span>Title<a href="#"><i class="fa fa-ellipsis-h"></i></a></span>
</div>
<div class="Part_Content">
<div class="Part_Content_Left">
<a href="#">Link 1</a>
<a href="#">Link 2</a>
</div>
<div class="Part_Content_right">
<img src="https://www.maltbazaren.dk/images/staal-300x300-t.png" />
</div>
</div>
<div class="Part_Footer">
<button>Show <i class="fa fa-caret-down"></i></button>
</div>
</div>

</div>
</div>
</div>
</div>

关于html - 将 div 保留在 Container 中,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/47712296/

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