gpt4 book ai didi

html - 使用 css 删除 后的斜线

转载 作者:行者123 更新时间:2023-11-28 02:00:53 27 4
gpt4 key购买 nike

我在尝试删除 标记后的文本以附加其他文本时遇到问题。我怎样才能删除它

<p class="entry-meta">
<span class="entry-author" itemprop="author" itemscope="">
<a href="#"class="entry-author-link" itemprop="url" rel="author">
<span class="entry-author-name" itemprop="name">yesi</span>
</a>
</span> / (this slash needs to be removed with css)</p>

最佳答案

<p class="replaced"><span>Original Text</span></p>

使用 CSS 显示属性,您可以隐藏标签内的内容,然后将包含新内容的伪元素附加到

标签。你不需要在这里使用绝对定位,因为 display: none;从页面中完全删除该元素,它确实会影响布局。就好像元素中的文本从未存在过一样。

这是 CSS:

.replaced span {
display: none;
}

.replaced:after {
content: "This text replaces the original.";
}

For More INfo click here

HTML :

 <p class="entry-meta replaced"><span class="entry-author" itemprop="author" 
itemscope=""><a href="#"class="entry-author-link" itemprop="url" rel="author"> <span class="entry-author-name" itemprop="name">yesi</span></a>
</span><span class="ll">/ (this slash needs to be removed with css)</span></p>

CSS

.ll {
display: none;
}

.replaced:after {
content: "This text replaces the original.";
}

jsfiddle

关于html - 使用 css 删除 <span> 后的斜线,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/49334306/

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