gpt4 book ai didi

html - 跨行的椭圆

转载 作者:太空宇宙 更新时间:2023-11-03 20:33:51 25 4
gpt4 key购买 nike

我正在尝试创建从左侧单元格末尾到右​​侧单元格文本开头有省略号的行。问题是左侧单元格的长度不同,右侧单元格的长度也不同。我试过对齐 2 个 div,然后用 overflow: ellipsis 结束右边的 div,然后用省略号开始右边的 div,但我不知道如何计算出在正确文本开始之前应该添加多少个点。

例如:

属性 1 .....................................值 1

一些属性 2................一些值 2

最佳答案

您可以使用flexorder 和一个pseudo 来绘制点

.ellipsis {
display:flex;
}
.ellipsis span {
order:2;
}
.ellipsis span:first-of-type {
order:0;
}
.ellipsis:before {
content:'';
display:inline-block;/* optionnal*/
border-bottom:dotted 1px;
flex:1;
order:1;
margin:0 0.2em 0.25em;/* you may tune this */
}
body {
padding-top:50px; /* demo snippet in the way */
}
<p class="ellipsis"><!-- any other tag as li or div does too, CSS does the styling -->
<span>ellipsis in</span>
<span>between</span>
</p>

关于html - 跨行的椭圆,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/36726237/

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