gpt4 book ai didi

html - 隐藏标题中的文字(Wordpress)

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

我正在使用 Wordpress,我想隐藏标题为“ protected :Pavanjot 和 Amandeep 的婚礼”的“ protected ”一词,我希望标题的其余部分保持原样。

我猜想使用自定义 css 我可以针对下面的代码来隐藏这个词吗?不过,我不确定如何实现这一目标。

<header class="entry-header page-header">
<h1 class="entry-title">Protected: Pavanjot &amp; Amandeep’s Wedding</h1>
</header>

我想隐藏或删除该词,以便剩余的文本向左对齐并且不留空隙。

任何帮助都非常感谢。

最佳答案

我不认为你可以在不修改标记的情况下用 CSS 做到这一点(然后你可以只删除文本),但你可以用几行 JS 来做到这一点。

<h1 class="entry-title">Protected: Pavanjot &amp; Amandeep’s Wedding</h1>
<script>
var entryTitle = document.querySelector('.entry-title'),
text = entryTitle.innerHTML;
entryTitle.innerHTML = text.substring(text.indexOf(" "), text.length);
</script>

关于html - 隐藏标题中的文字(Wordpress),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/42179775/

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