Introduction to using pure CSS to create collapsible tree menu methods
Source: Internet
Author: User
With the release of CSS3, foreign research is in full swing, but there are many people in the country holding IE does not support the idea of CSS3, always indifferent refused to learn. But history tells us that good things are bound to prevail, and that CSS3 will eventually replace CSS2, and the following will share a collapsible tree-like menu that you can create with CSS3.
Tree-like menu I believe we are not unfamiliar, we generally use css+js way to achieve. And the arrival of CSS3, let us get rid of the shackles of JS, direct use of CSS3 "selector" can be achieved collapsible tree menu.
The whole code is a lot, do not step-by-step, just put I think important place to say it.
The idea of implementation is to use the checked value of the checkbox to determine whether the sub-column is expanded, the CSS3 selector provides: checked this pseudo-class, this pseudo-class provides us, when the element has checked this value when the execution of your CSS. (Very powerful, isn't it?) With the CSS3 we will write a lot less js Oh!)
This is about the style that Inoput has when it has a checked.
Use IE9 the following browsing will not be seen, please use non-IE browser.
(It is also possible to have ie6+ browser support, but JS is required to emulate the CSS3 attribute.) A lot of people abroad have written to let ie6+ browser support some CSS3 JS, such as pie. )
Summarize:
Overall, the realization of the idea is very simple, mainly using CSS3 checked pseudo-class to realize the hidden display of ol. Unfortunately, IE browser does not support CSS3, but we can not because IE does not support the CSS3 to abandon the study. In foreign CSS3 and HTML5 are front-end very hot topic, they research things far more than we, but the domestic really to try is still not much, for a front-end developer is a very sad thing. I think that the CSS3 should arouse our attention, can't let us lose at the starting line. Let us all together to promote the development of CSS3.
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.