Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Hide text in html which does not have any html tags [duplicate]

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?

like image 942
Sergi Khizanishvili Avatar asked Apr 02 '18 10:04

Sergi Khizanishvili


People also ask

How do you hide the text in HTML?

Style display property is used to hide and show the content of HTML DOM by accessing the DOM element using JavaScript/jQuery. To hide an element, set the style display property to “none”. document.

How do you make content invisible in HTML?

The following style rule hides an element on a web page: display: none; When you set the value of display to none, the affected element will disappear. This means the element will no longer take up any space on the web page.

Which tags do not contain text or other tags?

A few tags are called non-container tags, because they don't contain any content - they stand alone. Examples are images and line breaks.

Which tag is not used in HTML?

<cite> and <q>


1 Answers

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>
like image 188
Temani Afif Avatar answered Sep 29 '22 00:09

Temani Afif