Terus untuk ngebuat transisinya kita cuma nambain transition ajjah sama ngubah display: block menggunakan visibilit sama hidden. Source code lengkapnya seperti terlihat di bawah (untuk yg CSS ajjah )
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 | nav { background-color: rgba(93, 236, 189, 0.6); position: relative; padding: 0 0 0 18px; margin-top: 30px; } nav ul { list-style: none; margin: 0; padding: 0; } nav > ul > li { float: left; } nav ul::after { content: ''; display: block; clear: both; } nav ul li a { display: inline-block; color: #fff; padding: 10px 20px; text-decoration: none; width: 125px; transition: all .5s ease-in; } nav ul li a:hover { background-color: #399939; } nav ul ul { visibility: hidden; opacity: 0; position: absolute; top: 100%; background-color: rgba(0, 102, 102, .7); transition: all 1s ease-in; } nav ul li:hover { background-color: rgba(0, 102, 102, .7); } nav ul li:hover > ul { visibility: visible; opacity: 1; } nav ul ul ul { left: 100%; top: 0; } nav ul ul li { position: relative; } |
Demonya bisa dilihat divideo berikut :
Source code githubnya bisa dilihat disini....
No comments:
Post a Comment