gpt4 book ai didi

css - 长文本应该被css隐藏

转载 作者:太空宇宙 更新时间:2023-11-04 08:05:22 25 4
gpt4 key购买 nike

我有这样的代码。HTML:

<div>
<h3>Sometext</h3>
</div>

CSS:

div {
width: 20px;
}
h3 {
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
}

这里的问题是 H3 标签“Sometext”应该只写成“Somete”,但 overflow 和 text-overflow 都没有帮助。仍然可以看到H3标签。

最佳答案

请检查这个。

h3 {   
width: 70px;
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
}
<div>
<h3>Sometext</h3>
</div>

关于css - 长文本应该被css隐藏,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/46679467/

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