在没有任何 html 标签的 html 中隐藏文本 [英] Hide text in html which does not have any html tags

查看:27
本文介绍了在没有任何 html 标签的 html 中隐藏文本的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在下面有 HTML 代码,并且文本周围没有任何 HTML.有什么方法可以隐藏文本Enter"在p"标签之后?

<p class="page-header" style="text-align: center;"><strong>回车</strong></p><p>&nbsp;</p>输入 <-- 我想隐藏此文本<div class="subhead"></div>

不可能用 div 或任何其他标签包装它,所以我需要一些不同的决定,比如 JavaScript 或一些 CSS?

解决方案

我会考虑使用 font-size 进行 CSS hack:

.entry {字体大小:0;}.入口 * {字体大小:初始;}

<p class="page-header" style="text-align: center;"><strong>回车</strong></p><p>&nbsp;这里的东西

输入(这将被隐藏!!)<div class="subhead">这里还有一段文字</div>

visibility 的另一个想法:

.entry {可见性:隐藏;}.入口 * {可见性:可见;}

<p class="page-header" style="text-align: center;"><strong>回车</strong></p><p>&nbsp;这里的东西

输入(这将被隐藏!!)<div class="subhead">这里还有一段文字</div>

I have HTML code here down below and there is text which does not have any HTML surrounding. Is there any method to hide the text "Enter" which is after "p" tag?

<div class="entry">
<p class="page-header" style="text-align: center;"><strong>Enter</strong></p>
<p>&nbsp;</p>
Enter <-- i want to hide this text
<div class="subhead"></div>
</div>

It is not possible to wrap it with a div or any other tag, so I need some different decision like JavaScript or some CSS?

解决方案

I would consider a CSS hack with font-size:

.entry {
  font-size:0;
}
.entry * {
  font-size:initial;
}

<div class="entry">
<p class="page-header" style="text-align: center;"><strong>Enter</strong></p>
<p>&nbsp; somethin here</p>
Enter (this will be hidden !!)
<div class="subhead">another text here</div>
</div>

Another idea with visibility:

.entry {
  visibility:hidden;
}
.entry * {
  visibility:visible;
}

<div class="entry">
<p class="page-header" style="text-align: center;"><strong>Enter</strong></p>
<p>&nbsp; somethin here</p>
Enter (this will be hidden !!)
<div class="subhead">another text here</div>
</div>

这篇关于在没有任何 html 标签的 html 中隐藏文本的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆