隐藏HTML中没有任何HTML标签的文本

隐藏HTML中没有任何HTML标签的文本

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

问题描述

我在下面有HTML代码,并且有没有任何HTML周边的文本。是否有任何方法可以隐藏p标签后面的



  < div class =entry> 
< p class =page-headerstyle =text-align:center;>< strong> Enter< / strong>< / p>
< p>& nbsp;< / p>
输入< - 我要隐藏此文本
< div class =subhead>< / div>
< / div>

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

解决方案

我会考虑使用字体大小的CSS破解:

.entry {font-size:0;}。entry * {font-size:initial; code>
 < div class =entry>< p class =page-headerstyle =text-align:center;>< strong>输入< / strong>< / p>< p>& nbsp; < / div>< / code>< / pre< / div>这里< / p> Enter(this will be hidden !!)< div class =subhead> > 



另一个想法是知名度



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

< div class =entry>< p class =page- headerstyle =text-align:center;>< strong> Enter< / strong>< / p>< p>& nbsp; < / div>< / code>< / pre< / div>这里< / p> Enter(this will be hidden !!)< div class =subhead> >


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标签的文本的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

09-05 13:08