gpt4 book ai didi

html - 如何在para旁边显示span元素?

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

我想在我的 div 中的段落文本旁边获取编辑按钮。到目前为止,我尝试过的内容已粘贴在我的笔中。我已将 a 标签放在 para 中,但我知道这不是正确的方法。

<div class="block-ellipsis">
<p>This is an example of a multi-line ellipsis.This is an example of a multi-line ellipsisThis is an example of a multi-line ellipsisThis is an example of a multi-line ellipsisThis is an example of a multi-line ellipsis <a href="#" class="editbtn">Edit</a></p>

</div>

.block-ellipsis {
background-color: rgba(204,204,204,0.4);
display: block;
display: -webkit-box;
max-width: 50%;
height: 43px;
margin: 0 auto;
font-size: 14px;
line-height: 1.5;
-webkit-line-clamp: 2;
-webkit-box-orient: vertical;
overflow: hidden;
text-overflow: ellipsis;
margin-bottom: 15px;
position: relative;
}
.block-ellipsis > p {
max-width: 90%;
}
.editbtn {
position: absolute;
right: 0;
top: 20px;

CODEPEN

最佳答案

更改一些 CSS

.block-ellipsis {
background-color: rgba(204,204,204,0.4);
display: block;
display: -webkit-box;
max-width: 50%;
height: 43px;
margin: 0 auto;

font-size: 14px;
line-height: 1.5;
-webkit-line-clamp: 2;
-webkit-box-orient: vertical;

margin-bottom: 15px;
position: relative;
}
.block-ellipsis > p {
max-width: 90%;
padding-right:20px;
white-space:nowrap;
overflow: hidden;
text-overflow: ellipsis;
position:relative;
}
.editbtn {
position: absolute;
right: 0px;
top: 0px;
}

https://codepen.io/anon/pen/rbGRNz

关于html - 如何在para旁边显示span元素?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/55686815/

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