Home > Web Front-end > HTML Tutorial > How to hide styles in html

How to hide styles in html

王林
Release: 2023-01-06 11:18:00
Original
3110 people have browsed it

htmlThe method to hide the style is to add the hidden attribute to the element, such as [

]. The hidden attribute can hide elements and hidden elements will not be displayed.

How to hide styles in html

The operating environment of this article: windows10 system, html 5, thinkpad t480 computer.

The hidden attribute specifies that the element is hidden. Hidden elements will not be displayed.

The hidden attribute can be set so that users can only see an element when certain conditions are met (such as checking a check box, etc.). You can then use JavaScript to remove the hidden attribute, making the element visible.

Code example:

<!DOCTYPE html>
<html>
<head> 
<meta charset="utf-8"> 
<title>php中文网(php.cn)</title> 
</head>
<body>

<p hidden="hidden">这是一段隐藏的段落。</p>
<p>这是一段可见的段落。</p>

</body>
</html>
Copy after login

Running effect:

How to hide styles in html

## Related video tutorial sharing:

html video tutorial

The above is the detailed content of How to hide styles in html. For more information, please follow other related articles on the PHP Chinese website!

Related labels:
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
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template