Monday, June 3, 2024
 Popular · Latest · Hot · Upcoming
0
rated 0 times [  3] [ 3]  / answers: 1 / hits: 37890  / 9 Years ago, sat, october 24, 2015, 12:00:00

I want to hide a section of HTML, and stop it being viewable from the webpage itself without removing it. Is this possible in HTML or CSS, or can anyone recommend a Javascript library capable of doing this? The part that needs hiding looks similar to this:



<p>text1<strong>text2</strong></p>


I don't want it to display on the website but I do want it viewable when looking at the code directly.



Any ideas?


More From » html

 Answers
25

Add a hidden class to select the target HTML and use display: none in CSS:



HTML:



<p class=hidden>text1<strong>text2</strong></p>


CSS:



.hidden {
display: none;
}


...or you could inline it directly:



<p style=display:none>text1<strong>text2</strong></p>

[#64619] Wednesday, October 21, 2015, 9 Years  [reply] [flag answer]
Only authorized users can answer the question. Please sign in first, or register a free account.
alejandro

Total Points: 231
Total Questions: 102
Total Answers: 107

Location: Jordan
Member since Wed, Jun 17, 2020
4 Years ago
alejandro questions
Mon, Jul 18, 22, 00:00, 2 Years ago
Fri, Sep 18, 20, 00:00, 4 Years ago
Thu, Sep 10, 20, 00:00, 4 Years ago
;