【发布时间】:2019-07-20 02:36:39
【问题描述】:
使用引导程序,我有一行和两列。第一个包含图像,第二个包含文本。我试图在图像高度切断文本。如果没有 JavaScript 和固定高度,这可能吗?
感谢您的帮助!
.row {
margin: 1rem 0 0 1rem !important;
max-width: 20rem;
}
div>div {
border: 1px solid red;
}
.col-5 {
padding: 0 !important;
}
.col-7 {
overflow-y: hidden;
/* How do I make this column as tall as the previous? */
}
<link href="https://cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/4.1.3/css/bootstrap.min.css" rel="stylesheet"/>
<div class="row">
<div class="col-5">
<img src="https://booklers.net/images/userImages/Doidel/bookImages/4/thumb.jpg" class="img-fluid" />
</div>
<div class="col-7">
This is some test text. This is some more test text. This is some more test text. This is some more test text. This is some more test text. This is some more test text. This is some more test text. This is some more test text. This is some more test text. This is some more test text.
</div>
</div>
【问题讨论】:
-
你需要定义一个固定的
height,否则没有参考点来确定什么是“溢出”的内容 -
啊,可惜了。感谢您的回答。您介意将其发布为答案,以便我接受吗?
-
要滚动文本列吗?
-
嗯没关系,但这不是必需的。可能我会把它隐藏起来,点击显示全文,但为了这个演示,它真的没关系。
标签: css twitter-bootstrap