gpt4 book ai didi

javascript - 强制 div 溢出而不是调整大小

转载 作者:行者123 更新时间:2023-12-02 21:18:02 25 4
gpt4 key购买 nike

我正在努力解决使两列具有相同高度的问题。

Two column with diffenrent height

当文本不够长时,两列仍然具有相同的高度。但除此之外,<div>自动调整自身大小,使它们具有不同的高度。

我尝试过使用溢出自动,但它不起作用。

这是我的作品。 https://jsfiddle.net/kcaxy5Lh/1/

最佳答案

bootstrap 建立高度的方式很奇怪,他们在 .row 类上有 flex-wrap:wrap ,可以防止溢出的发生。

我们需要删除它并将布局更改为 flex-direction:column 然后向下传播高度。

.info-tab {
color: #BBB;
}

.comment {
text-align: right;
}

.btn:focus {
outline: none;
}


/* Comment section */

.comment-wrapper .media-list .media {
border-bottom: 1px dashed #efefef;
margin-bottom: 25px;
}

.user_name {
font-size: 14px;
font-weight: bold;
}

.comments-list .media {
border-bottom: 1px dotted #ccc;
}

.title {
font-size: 14px;
font-weight: bold;
}

.komen {
font-size: 14px;
}

img {
display: block;
max-width: 100%;
height: auto;
}


/* NEW */

#myTabContent,
#profile {
height: 100%;
}

#profile>div {
flex-wrap: nowrap;
flex-direction: column;
height: 100%;
}

#infoTab>div {
overflow: auto;
}
<link href="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0/css/bootstrap.min.css" rel="stylesheet" />

<body class="bg-dark">
<div class="container-fluid bg-dark">

<div class="row px-3">
<div class="col-xs-12 col-md-8 mt-5 embed-responsive embed-responsive-16by9 h-100" id="player">
<iframe src="https://www.youtube.com/embed/2lAe1cqCOXo&t" width="640" height="480"></iframe>
</div>
<div class="col-xs-6 col-md-4 mt-5" id="infoTab">
<div class="h-100 ml-2" style="border: 1px solid #555;">
<div class="mx-3 h-100">
<!-- Navication episode/comments -->
<ul class="nav nav-tabs nav-fill py-3" id="myTab" role="tablist">
<li class="nav-item text-right mx-2">
<a class="info-tab btn comment" id="profile-tab" data-toggle="tab" href="#profile" role="tab" aria-controls="comment" aria-selected="false">Comments</a>
</li>
</ul>
<br>
<!-- Navication Content -->
<div class="tab-content mx-1 container overflow-auto" id="myTabContent">
<div class="tab-pane fade show active text-white f-right overflow-auto container" id="profile" role="tabpanel" aria-labelledby="profile-tab">
<!-- COMMENTs | https://bootsnipp.com/snippets/M5obX -->
<div class="row py-1 overflow-auto">

<div class="col media p-0">
<div class="form-inline roundBorder mr-3">
<i class="form-inline fa fa-user" aria-hidden="true" style="color: #AAA;"></i>
</div>
<div class="media-body">
<h4 class="media-heading title text-primary">Fahmi Arif</h4>
<p class="komen">
kalo bisa ya ndak usah gan biar cepetasdiojahdakssak<br> abc
<br>
</p>
</div>
</div>

<div class="w-100"></div>

<div class="col media p-0">
<div class="form-inline roundBorder mr-3">
<i class="form-inline fa fa-user" aria-hidden="true" style="color: #AAA;"></i>
</div>
<div class="media-body">
<h4 class="media-heading title text-primary">Fahmi Arif</h4>
<p class="komen">
kalo bisa ya ndak usah gan biar cepetasdiojahdakssak<br> abc
<br>
</p>
</div>
</div>

<div class="w-100"></div>

<div class="col media p-0">
<div class="form-inline roundBorder mr-3">
<i class="form-inline fa fa-user" aria-hidden="true" style="color: #AAA;"></i>
</div>
<div class="media-body">
<h4 class="media-heading title text-primary">Fahmi Arif</h4>
<p class="komen">
kalo bisa ya ndak usah gan biar cepetasdiojahdakssak<br> abc
<br>
</p>
</div>
</div>

<div class="w-100"></div>

<div class="col media p-0">
<div class="form-inline roundBorder mr-3">
<i class="form-inline fa fa-user" aria-hidden="true" style="color: #AAA;"></i>
</div>
<div class="media-body">
<h4 class="media-heading title text-primary">Fahmi Arif</h4>
<p class="komen">
kalo bisa ya ndak usah gan biar cepetasdiojahdakssak<br> abc
<br>
</p>
</div>
</div>

<div class="w-100"></div>

<div class="col media p-0">
<div class="form-inline roundBorder mr-3">
<i class="form-inline fa fa-user" aria-hidden="true" style="color: #AAA;"></i>
</div>
<div class="media-body">
<h4 class="media-heading title text-primary">Fahmi Arif</h4>
<p class="komen">
kalo bisa ya ndak usah gan biar cepetasdiojahdakssak<br> abc
<br>
</p>
</div>
</div>

<div class="w-100"></div>

</div>
<!-- END COMMENT -->
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</body>

关于javascript - 强制 div 溢出而不是调整大小,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/60917082/

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