如何使卡具有相同的高度?

发布于 2025-02-08 17:51:53 字数 1158 浏览 1 评论 0原文

我的卡高音并未按照我的预期显示。我当时想将最大高度设置为我的V-Card-Text

“在此处输入图像描述”

<v-col cols="3" v-for="note in notes">
    <v-card :loading="loading" max-width="374">
        <template slot="progress">
            <v-progress-linear color="deep-purple" height="10" indeterminate></v-progress-linear>
        </template>

        <v-img height="250" :src="note.img"></v-img>

        <v-card-title>{{ note.name }}</v-card-title>

        <v-card-text height="200px">
            <div>{{ note.description }}</div>
        </v-card-text>

        <v-card-text>
            <v-chip-group v-model="selection" active-class="deep-purple accent-4 white--text" column>
                <v-chip v-for="tag in note.tag">
                    {{ tag }}
                </v-chip>
            </v-chip-group>
        </v-card-text>
    </v-card>
</v-col>

我认为

对我没有任何建议吗?

My card hights is not displaying consistently as I intended. I was thinking to set the max-height to my v-card-text

enter image description here

<v-col cols="3" v-for="note in notes">
    <v-card :loading="loading" max-width="374">
        <template slot="progress">
            <v-progress-linear color="deep-purple" height="10" indeterminate></v-progress-linear>
        </template>

        <v-img height="250" :src="note.img"></v-img>

        <v-card-title>{{ note.name }}</v-card-title>

        <v-card-text height="200px">
            <div>{{ note.description }}</div>
        </v-card-text>

        <v-card-text>
            <v-chip-group v-model="selection" active-class="deep-purple accent-4 white--text" column>
                <v-chip v-for="tag in note.tag">
                    {{ tag }}
                </v-chip>
            </v-chip-group>
        </v-card-text>
    </v-card>
</v-col>

I see no effect

Any suggestions for me ?

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

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

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

走走停停 2025-02-15 17:51:53

您可以实现这一目标:

.v-card-text {
  height: 200px;
  overflow-y: auto;
}

如果您不想要卷轴,并且裁剪的文字很好:
Overflow-y:hidden;

缺点:

  • .v-card-text 始终具有此高度
  • 想要在浏览器上自定义滚动栏外观,这些浏览器在桌面上显示宽滚动条(17px)(例如:Chrome)。

另外,如果您希望每行中的最高卡设置高度(带有不同高度的卡的行)且没有任何溢出,但是在某些卡上有一些空白,我可以帮助您实现它,如果您创建了它可运行的片段,所以我可以测试。原则上,您需要给出卡容器显示:flex; flex方向:列;并给出.v-card-text {flex-grow:1}

在实践中,该卡可能包含多个包装器,这就是为什么如果您对此解决方案感兴趣,我需要看现场片段的原因。

You can achieve it with:

.v-card-text {
  height: 200px;
  overflow-y: auto;
}

If you don't want a scrollbar and you're fine with the text being cropped:
overflow-y: hidden;

Shortcomings:

  • .v-card-text will always have this height, even if all items on a row end up not using all of it
  • you might want to customise the scrollbar appearance on browsers which display a wide scrollbar (17px) on desktop (e.g: Chrome).

Alternatively, if you want the tallest card in each row to set the height (resulting in rows with cards of different heights) and not have any overflow, but have some white space on some cards instead, I can help you achieve it if you create a runnable snippet, so I can test. In principle, you need to give the card container display: flex; flex-direction: column; and give .v-card-text { flex-grow: 1 }.

In practice, the card might have more than one wrapper, which is why I need to see a live snippet, if you're interested in this solution.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文