当不同的孩子变小时,CSS如何使孩子变大

发布于 2025-02-05 06:53:13 字数 383 浏览 2 评论 0原文

我得到了一些卡片,这些卡应该显示一个网站的预告片,并从该网站上获取标题和摘录。底部灰色背景是display:Flex的父级。我将容器设置为高度:200px,并且子元素应适合内部。

因为标题和文本的网站之间的不同,所以我希望仅在一个CSS课程中尽可能地适合它们。

因此,当标题短并且只占用一行时,我想在摘录字段中添加一行。

有什么办法可以通过CSS实现这一目标? 可以显示:Flex处理此操作?我尝试使用flex-grow,但它不起作用

示例的预览“”>

I got some cards that should show a trailer of a website taking the title and a excerpt from that given website. The bottom grey background is a parent div with display: flex on it. I've set the container to height: 200px and the child elements should fit inside.

Because the title and text can vary from site to site i would like to make them fit as best as possible with just one CSS class.

So, when a title is shorter and only takes up one line, I would like to add one line to the excerpt field.

Is there any way to make that happen with CSS? can display: flex handle this? I've tried to use flex-grow but it doesn't work

Preview of the example

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。
列表为空,暂无数据
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文