Home > Web Front-end > CSS Tutorial > How Can I Hide Text in HTML Without Using Tags?

How Can I Hide Text in HTML Without Using Tags?

Susan Sarandon
Release: 2024-12-24 08:43:13
Original
698 people have browsed it

How Can I Hide Text in HTML Without Using Tags?

Hiding Text in HTML Without Tags

Despite the absence of HTML tags surrounding certain text, it is possible to conceal it using CSS tricks. In the code snippet below, the text "Enter" within the "p" tag needs to be hidden.

<div>
Copy after login

One CSS hack involves manipulating the font size:

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

By setting the font size of the "entry" class to 0, all elements within it will become invisible. However, the "*" selector in the second rule resets the font size to its initial value, making all elements visible again except for those directly within the "entry" class. Therefore, the "Enter" text between the "p" tags will be effectively hidden.

The above is the detailed content of How Can I Hide Text in HTML Without Using Tags?. For more information, please follow other related articles on the PHP Chinese website!

source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Latest Articles by Author
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template