Home  >  Article  >  Web Front-end  >  How to show hidden elements in css

How to show hidden elements in css

醉折花枝作酒筹
醉折花枝作酒筹Original
2021-04-23 18:49:515960browse

In CSS, you can use the display attribute to display hidden elements. You only need to add the "display:block" style to the hidden elements. The display attribute specifies the type of element that should be generated. When the value is block, it means that the hidden element will be displayed.

The operating environment of this tutorial: Windows 7 system, CSS3&&HTML5 version, Dell G3 computer.

Create a new html file, named test.html, to explain how to display CSS hidden elements.

How to show hidden elements in css

In the test.html file, use the p tag to create two lines of text for testing.

How to show hidden elements in css

In the test.html file, add a class attribute to the first p tag. The attribute value is mytest. It is mainly used to set the style of the p tag through this class.

How to show hidden elements in css

##In the test.html file, write the tag. The css style of the page will be written in this within the label.

How to show hidden elements in css

In the css tag, set the css style of the p tag through class(mytest), and set the display attribute to none to hide the content of the p tag.

How to show hidden elements in css

In the hidden p tag, use style to set the style of the p tag, and set the display attribute to block to display the hidden p tag.

How to show hidden elements in css

Open the test.html file in the browser to check the effect.

How to show hidden elements in css

Recommended learning:

css video tutorial

The above is the detailed content of How to show hidden elements in css. For more information, please follow other related articles on the PHP Chinese website!

Statement:
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