display: none 不起作用_html/css_WEB-ITnose

WBOY
Release: 2016-06-24 11:15:12
Original
3677 people have browsed it

<html>    <head>        <meta http-equiv="content-type" content='text/html;charset=utf-8'/>        <style>        <!--本页的css样式-->       .reveal * {display: none;}       /*.reveal * {background-color: gray;}*/              .reveal *.handle {display: block;}       .reveal *.handle {background-color: gray;}        </style>    </head>    <body>        <div class="reveal">         <h1 class="handle">Click Here to Reveal Hidden Text</h1>         <p>This paragraph is hidden. It appears when you click on title.</p>        </div>    </body></html>
Copy after login



.reveal * {display: none;}应该是除了.handle元素外都隐藏,为什么display: none不起作用呢?


回复讨论(解决方案)

重叠了,前面类的display就无效。


       .reveal * {display: none;}的效果被.reveal *.handle {display: block;}覆盖了

首先,把这个注释改了,style标签(即CSS)里面的注释是  /*   */ ,改成 /*本页的css样式*/ 
优先级的问题,.reveal *.handle高于.reveal * {display: none;},优先级高的生效



这个不是 css的注意语法  下面一行 样式就被破坏了

3,4楼正解,谢谢了

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
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!