מדריך נפתח של CSS: כיצד ליצור תפריט נפתח ב- CSS

מהם נפילות?

תפריטים נפתחים משמשים ב- CSS כדי להסתיר רשימה מוגדרת מראש בתוך כפתור.

דוגמאות:

 Name One Two Three 

אז עליך להתאים אישית את השיעורים ב- CSS כך:

.dropdown { position: relative; display: inline-block; } .dropbtn { background-color: red; padding: 10px; } .dropdown-content { display: none; position: absolute; } .dropdown:hover .dropdown-content { display:block; }

אתה זקוק למחלקות ה- div הנפרדות כדי ליצור את הכפתור, ו- div אחר כדי להפריד בין רשימת הכפתור.

דוגמה

 Content 1 Content 2 × Content 3 Content 4 Content 5 
#myNav1 { height: 0; width: 50%; position: fixed; z-index: 6; top: 0; left: 0; background-color: #ffff; overflow: hidden; transition: 0.3s; opacity: 0.85; } #myNav2 { height: 0; width: 50%; position: fixed; z-index: 6; bottom: 0; right: 0; background-color: #ffff; overflow: hidden; transition: 0.3s; opacity: 0.85; } .overlay-content { position: relative; width: 100%; text-align: center; margin-top: 30px; } #myNav1-content{ top: 12%; left: 5%; display: none; } #myNav2-content{ top: 12%; right: 10%; display: none; }

מידע נוסף על נפילות CSS:

  • כיצד ליצור תפריט נפתח עם CSS ו- JavaScript