Qanday Menyu Qilish Kerak

Mundarija:

Qanday Menyu Qilish Kerak
Qanday Menyu Qilish Kerak

Video: Qanday Menyu Qilish Kerak

Video: Qanday Menyu Qilish Kerak
Video: Qanday tavba qilish kerak? | Solihxon domla bilan suhbat 2024, Noyabr
Anonim

Sahifa maketini tejash bilan birga bo'limlar va pastki bo'limlarning tuzilishini yanada aniqroq ko'rsatish uchun saytni joylashtirishda ochiladigan pastki menyu bo'limlari bo'lgan menyudan foydalaniladi. Bunday mexanizmni amalga oshirish unchalik qiyin emas: amalga oshirish misollaridan biri maqolada keltirilgan.

Qanday menyu qilish kerak
Qanday menyu qilish kerak

Ko'rsatmalar

1-qadam

Quyida sahifaning to'liq manba kodi keltirilgan. Uslublarning tavsiflari to'g'ridan-to'g'ri sahifaning matniga joylashtirilgan. Html-da va menyu dasturining ushbu variantidagi CSS-da batafsil tushuntirishni talab qiladigan murakkab tuzilmalar mavjud emas.

2-qadam

<! DOCTYPE html PUBLIC "- // W3C // DTD XHTML 1.0 Transitions // EN"

"https://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

Bo'limlari bo'lgan oddiy ochiladigan menyu

* {

font-family: arial;

shrift hajmi: 16px;

}

/ * eski IE brauzerlari uchun * /

body {behavior: url ("csshover.htc");}

ul, li, a {

displey: blok;

margin: 0;

to'ldirish: 0;

chegara: 0;

}

ul {

kengligi: 150 piksel;

chegara: 1px qattiq kumush;

fon: oq;

ro'yxat uslubi: yo'q;

}

li {

pozitsiya: nisbiy;

to'ldirish: 1 piksel;

fon-rang: kumush;

z-indeks: 9;

}

li.folder {fon-rang: kumush;}

li.folder ul {

pozitsiya: mutlaq;

chapda: 111px; / * Faqat IE * /

yuqori: 5px;

}

li.folder> ul {chap: 140px;} / * boshqalar uchun * /

a {

to'ldirish: 2 piksel;

chegara: 1px qattiq oq;

matnni bezatish: yo'q;

rang: qora;

shrift og'irligi: qalin;

kengligi: 100%; / * IE uchun * /

}

li> a {width: auto;} / * boshqalar uchun * /

li a {

displey: blok;

kengligi: 140 piksel;

}

li a.submenu {

fon-rang: sariq;

}

/ * Boblar * /

a: hover {

chegara rang: kulrang;

fon-rang: qizil;

rang: qora;

}

li.folder a: hover {

fon-rang: qizil;

}

/ * Bo'limlar * /

li.folder: hover {z-index: 10;}

ul ul, li: hover ul ul {displey: none;}

li: hover ul, li: hover li: hover ul {display: block;}

  • 1. Bob
  • 2. Bo'lim

    • 2.1 bob
    • 2.2 bo'lim

      • 2.2.1 bob
      • 2.2.2 bob
      • 2.2.3 bob
    • 2.3 bob
  • 3. Bo'lim

    • 3.1 bob
    • 3.2 bob
    • 3.3 bob
  • 4. Bob
Pastki menyularning ochiladigan ro'yxatlari bilan menyu
Pastki menyularning ochiladigan ro'yxatlari bilan menyu

3-qadam

Agar siz allaqachon eskirgan brauzer modifikatsiyasini qo'llab-quvvatlash uchun ushbu parametrdan foydalanmoqchi bo'lsangiz, unda uslub tavsiflari blokiga qo'shimcha satr qo'shilishi kerak (darhol keyin) (sharh qo'shishingiz shart emas):

/ * eski IE brauzerlari uchun * /

body {behavior: url ("csshover.htc");}

4-qadam

Keyin alohida sahifa yarating, uning mazmuni quyida ko'rsatilgan.

window. CSSHover = (function () {var m = / (^ | / s) ((([^ a] ([^] +)?) | (a ([^ #.] [^] +) +))):(hover | active | focus)) / i; var n = / (. *?):(hover | active | focus) / i; var o = / [^:] +: ([az / -] +). * / i; var p = / (. ([a-z0-9 _ / -] +): [az] +) | (: [az] +) / gi; var q = / \. ([a-z0-9 _ / -] * on (hover | active | focus)) / i; var s = / msie (5 | 6 | 7) / i; var t = / backcompat / i; var u = {index: 0, list: ['text-kashida', 'text-kashida-space', 'text-justify'], get: function () {return this.list [(this.index ++)% this. list.length]}}; var v = function (c) {return c.replace (/-(.)/ mg, function (a, b) {return b.toUpperCase ()})}; var w = {elements: , qayta qo'ng'iroqlar: {}, init: function () {if (! s.test (navigator.userAgent) &&! t.test (window.document.compatMode)) {return} var a = window.document.styleSheets, l = a.length; for (var i = 0; i <l; i ++) {this.parseStylesheet (a )}}, parseStylesheet: function (a) {if (a.imports) {try {var b = a. import; var l = b.length; for (var i = 0; i <l; i ++) {this.parseStylesheet (a.imports )}} catch (securityException) {} } sinab ko'ring {var c = a. qoidalar; var r = c. uzunlik; uchun (var j = 0; j <r; j ++) {this.parseCSSRule (c [j], a)}} ca tch (someException) {}}, parseCSSRule: function (a, b) {var c = a.selectorText; if (m.test (c)) {var d = a.style.cssText; var e = n.exec (c) [1]; var f = c.lace (o, 'on $ 1'); var g = c.lace (p, '. $ 2' + f); var h = q.exec (g) [1]; var i = e + h; if (! This.callbacks ) {var j = u.get (); var k = v (j); b.addRule (e, j + ': express (CSSHoverover (this, "'+ f +'", "'+ h +'", "'+ k +'")) '); this.callbacks = true} b.addRule (g, d)} }, patch: function (a, b, c, d) {try {var f = a.parentNode.currentStyle [d]; a.style [d] = f} catch (e) {a.runtimeStyle [d] = ''} if (! a.csshover) {a.csshover = } if (! a.csshover [c]) {a.csshover [c] = true; var g = new CSSHoverElement (a, b, c); this.elements.push (g)} return b}, unload: function () {try {var l = this.elements.length; for (var i = 0; i <l; i ++) {this.elements .unload ()} this.elements =; this.callbacks = {}} catch (e) {}}}; var x = {onhover: {activator: 'onmouseenter', deactivator: 'onmouseleave'}, faol emas: {activator: 'onmousedown', deactivator: 'onmouseup'}, onfocus: {activator: 'onfocus', deactivator: 'onblur'}}; function CSSHoverElement (a, b, c) {this.node = a; bu.t ype = b; var d = yangi RegExp ('(^ | / s)' + c + '(s | $)', 'g');

this.activator = function () {a.className + = '' + c}; this.deactivator = function () {a.className = a.className.replace (d, '')}; a.attachEvent (x .activator, this.activator); a.attachEvent (x .deactivator, this.deactivator)} CSSHoverElement.prototype = {unload: function () {this.node.detachEvent (x [this.type]. activator, this.activator); this.node.detachEvent (x [this.type].deactivator, this.deactivator); this.activator = null; this.deactivator = null; this.node = null; this.type = null }}; window.attachEvent ('onbeforeunload', function () {w.unload ()}); return function (a, b, c, d) {if (a) {return w.patch (a, b, c, d)} else {w.init ()}}}) ();

5-qadam

Ushbu sahifani csshover.htc nomi bilan saqlash va asosiy sahifa bilan bir joyda joylashtirish kerak.

Tavsiya: