Created
February 3, 2015 10:30
-
-
Save YidaChen/22f82722d7c7501dcfdc to your computer and use it in GitHub Desktop.
CSS third-level drop-down menu(transition:opacity)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <div id="nav"> | |
| <ul> | |
| <li><a href="#">HTML</a> | |
| </li> | |
| <li><a href="#">CSS</a> | |
| <ul> | |
| <li><a href="#">less</a> | |
| </li> | |
| <li><a href="#">sass</a> | |
| <ul> | |
| <li><a href="#">less</a> | |
| </li> | |
| <li><a href="#">sass</a> | |
| </li> | |
| </ul> | |
| </li> | |
| </ul> | |
| </li> | |
| <li><a href="#">JavaScript</a> | |
| <ul> | |
| <li><a href="#">AngularJS</a> | |
| <ul> | |
| <li><a href="#">AngularJS</a> | |
| </li> | |
| <li><a href="#">jQuery</a> | |
| </li> | |
| </ul> | |
| </li> | |
| <li><a href="#">jQuery</a> | |
| </li> | |
| </ul> | |
| </li> | |
| <li><a href="#">PHP</a> | |
| </li> | |
| <li><a href="#">Python</a> | |
| </li> | |
| </ul> | |
| </div> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #nav { | |
| width: 500px; | |
| height: 40px; | |
| background-color: #eee; | |
| margin: 0 auto; | |
| } | |
| ul { | |
| list-style: none; | |
| padding: 0; | |
| margin: 0; | |
| } | |
| ul li { | |
| float: left; | |
| position: relative; | |
| } | |
| a { | |
| text-decoration: none; | |
| color: #000; | |
| display: block; | |
| width: 100px; | |
| line-height: 40px; | |
| text-align: center; | |
| } | |
| a:hover { | |
| color: #fff; | |
| background: #666; | |
| } | |
| ul li ul { | |
| position: absolute; | |
| left: 0; | |
| top: 40px; | |
| visibility:hidden; | |
| opacity:0; | |
| transition:visibility 0.5s,opacity 1s; | |
| } | |
| ul li:hover>ul { | |
| visibility:visible; | |
| opacity:1; | |
| } | |
| ul li ul li { | |
| float : none; | |
| background: #eee; | |
| margin-top: 2px; | |
| } | |
| ul li ul li ul { | |
| position: absolute; | |
| top: 0px; | |
| left: 100px; | |
| visibility:hidden; | |
| opacity:0; | |
| transition:visibility 0.5s,opacity 1s; | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment