Ocena wątku:
  • 1 głosów - średnia: 5
  • 1
  • 2
  • 3
  • 4
  • 5
Poziome menu CSS [Problem]
#1
Question 
Witam.
Mam pewien problem z menu CSS. Chodzi o to, że nie mogę go wycentrować, dużo szukałem i robiłem, ale dalej nic. Poniżej zamieszam kod menu.

Obecnie menu wygląda tak:
[Obrazek: menucssa.jpg]

A chciałbym, żeby wyglądało tak.
[Obrazek: menucss.jpg]

Proszę o pomoc. Z góry dziękuje.

CSS
Cytat:.preload1 {background: url(images/menu_1.gif);}
.preload2 {background: url(images/six_1a.gif);}

#nav {padding:0; margin:0; list-style:none; height:38px; background:#000000 url(images/menu_1.gif) repeat-x; position:ative; z-index:200; font-family:arial, verdana, sans-serif;}
#nav li.top {float:left; display:block;}
#nav li a.top_link {float:left; display:block; height:35px; line-height:33px; color:#ccc; text-decoration:none; font-size:11,4px; font-weight:bold; padding:0 0 0 12px; cursor:pointer;background: url(images/six_0.gif);}
#nav li a.top_link span {float:left; display:block; padding:0 24px 0 12px; height:35px; background: url(images/menu_1.gif) right top no-repeat;}
#nav li a.top_link span.down {float:left; display:block; padding:0 24px 0 12px; height:35px; background: url(images/menu_1.gif) no-repeat right top;}

#nav li:hover a.top_link,
#nav a.top_link:hover
{color:#fff; background: url(images/menu_2.gif) no-repeat;}
#nav li:hover a.top_link span,
#nav a.top_link:hover span
{background:url(images/menu_2.gif) no-repeat right top;}
#nav li:hover a.top_link span.down,
#nav a.top_link:hover span.down
{background:url(images/six_1a.gif) no-repeat right top; padding-bottom:3px;}

#nav table {border-collapse:collapse; padding:0; margin:0; position:absolute; left:0; top:0;}

#nav li:hover {position:relative; z-index:200;}
#nav a:hover {position:relative; white-space:normal; z-index:200;}

#nav :hover ul.sub
{left:1px; top:38px; background: #50b5d0; padding:3px; border:1px solid #0b4d97; white-space:nowrap; width:90px; height:auto; z-index:300;}
#nav :hover ul.sub li
{display:block; height:20px; position:relative; float:left; width:90px; font-weight:normal;}
#nav :hover ul.sub li a
{display:block; font-size:11px; height:18px; width:88px; line-height:18px; text-indent:5px; color:#000; text-decoration:none;border:1px solid #50b5d0;}
#nav li ul.sub li a.fly
{background:#50b5d0 url(arrow.gif) 80px 6px no-repeat;}
#nav :hover ul.sub li a:hover
{background:#3f96a9; color:#fff; border-color:#fff;}
#nav :hover ul.sub li a.fly:hover
{background:#3f96a9 url(images/arrow_over.gif) 80px 6px no-repeat; color:#fff;}

#nav li b {display:block; font-size:11px; height:18px; width:88px; line-height:18px; margin-bottom:3px; text-indent:6px; color:#ff6; border-bottom:1px solid #ff6; cursor:default;}

#nav a:hover a:hover ul,
#nav a:hover a:hover a:hover ul,
#nav a:hover a:hover a:hover a:hover ul,
#nav a:hover a:hover a:hover a:hover a:hover ul
{left:89px; top:-4px; background: #50b5d0; padding:3px; border:1px solid #0b4d97; white-space:nowrap; width:90px; z-index:400; height:auto;}

#nav ul,
#nav a:hover ul ul,
#nav a:hover a:hover ul ul,
#nav a:hover a:hover a:hover ul ul,
#nav a:hover a:hover a:hover a:hover ul ul
{position:absolute; left:-9999px; top:-9999px; width:0; height:0; margin:0; padding:0; list-style:none;}

#nav li:hover li:hover > ul
{left:90px; top:-4px; background: #50b5d0; padding:3px; border:1px solid #0b4d97; white-space:nowrap; width:90px; z-index:400; height:auto;}
#nav li:hover > ul ul
{position:absolute; left:-9999px; top:-9999px; width:0; height:0; margin:0; padding:0; list-style:none;}
#nav li:hover li:hover > a.fly
{background:#3f96a9 url(images/arrow_over.gif) 80px 6px no-repeat; color:#fff; border-color:#fff;}
#nav li:hover li:hover > li a.fly
{background:#50b5d0 url(images/arrow.gif) 80px 6px no-repeat; color:#000; border-color:#50b5d0;}

HTML
Cytat: <ul id='nav'>
<div align='left'>
<li class='top'><a href='".BASEDIR."news.php' class='top_link'><span>Strona główna</span></a></li>
<li class='top'><a href='/forum' class='top_link'><span>Forum</span></a></li>
<li class='top'><a href='/forum/viewforum.php?f=7' class='top_link'><span>Liga typerów</span></a></li>
<li class='top'><a href='/photogallery.php' class='top_link'><span>Galeria</span></a></li>
<li class='top'><a href='/contact.php' class='top_link'><span>Kontakt</span></a></li>
</ul></div>
Odpowiedz
#2
(17-10-2010, 14:42)lolnik napisał(a): #nav {padding:0; margin:0; list-style:none; height:38px; background:#000000 url(images/menu_1.gif) repeat-x; position:ative; z-index:200; font-family:arial, verdana, sans-serif;}
#nav li.top {float:left; display:block;}
Co to?
dorzuć do #nav text-align:center;
Odpowiedz
#3
Niestety nie pomogło :/

Ps. Do active nie dopisałem rel
Odpowiedz
#4
Straszny nieład masz w kodzie...
Po pierwsze: <div align=left> - tego być nie powinno.
żadnych float:left w elemantach listy, lepiej jednorazowo zastosować display:inline. Masz kod:
Kod:
#nav {padding:0; margin:0 auto; list-style:none; height:38px; background:#000000 url(images/menu_1.gif) repeat-x; text-align:center; position:relative; z-index:200; font-family:arial, verdana, sans-serif;}
#nav li.top {display:inline;}
#nav li a.top_link {height:35px; line-height:33px; color:#ccc; text-decoration:none; font-size:11,4px; font-weight:bold; padding:0 0 0 12px; cursor:pointer;background: url(images/six_0.gif);}
#nav li a.top_link span {padding:0 24px 0 12px; height:35px; background: url(images/menu_1.gif) right top no-repeat;}
#nav li a.top_link span.down {padding:0 24px 0 12px; height:35px; background: url(images/menu_1.gif) no-repeat right top;}

#nav li:hover a.top_link,
#nav a.top_link:hover
{color:#fff; background: url(images/menu_2.gif) no-repeat;}
#nav li:hover a.top_link span,
#nav a.top_link:hover span
{background:url(images/menu_2.gif) no-repeat right top;}
#nav li:hover a.top_link span.down,
#nav a.top_link:hover span.down
{background:url(images/six_1a.gif) no-repeat right top; padding-bottom:3px;}

#nav table {border-collapse:collapse; padding:0; margin:0; position:absolute; left:0; top:0;}

#nav li:hover {position:relative; z-index:200;}
#nav a:hover {position:relative; white-space:normal; z-index:200;}

#nav :hover ul.sub
{left:1px; top:38px; background: #50b5d0; padding:3px; border:1px solid #0b4d97; white-space:nowrap; width:90px; height:auto; z-index:300;}
#nav :hover ul.sub li
{display:block; height:20px; position:relative; float:left; width:90px; font-weight:normal;}
#nav :hover ul.sub li a
{display:block; font-size:11px; height:18px; width:88px; line-height:18px; text-indent:5px; color:#000; text-decoration:none;border:1px solid #50b5d0;}
#nav li ul.sub li a.fly
{background:#50b5d0 url(arrow.gif) 80px 6px no-repeat;}
#nav :hover ul.sub li a:hover
{background:#3f96a9; color:#fff; border-color:#fff;}
#nav :hover ul.sub li a.fly:hover
{background:#3f96a9 url(images/arrow_over.gif) 80px 6px no-repeat; color:#fff;}

#nav li b {display:block; font-size:11px; height:18px; width:88px; line-height:18px; margin-bottom:3px; text-indent:6px; color:#ff6; border-bottom:1px solid #ff6; cursor:default;}

#nav a:hover a:hover ul,
#nav a:hover a:hover a:hover ul,
#nav a:hover a:hover a:hover a:hover ul,
#nav a:hover a:hover a:hover a:hover a:hover ul
{left:89px; top:-4px; background: #50b5d0; padding:3px; border:1px solid #0b4d97; white-space:nowrap; width:90px; z-index:400; height:auto;}

#nav ul,
#nav a:hover ul ul,
#nav a:hover a:hover ul ul,
#nav a:hover a:hover a:hover ul ul,
#nav a:hover a:hover a:hover a:hover ul ul
{position:absolute; left:-9999px; top:-9999px; width:0; height:0; margin:0; padding:0; list-style:none;}

#nav li:hover li:hover > ul
{left:90px; top:-4px; background: #50b5d0; padding:3px; border:1px solid #0b4d97; white-space:nowrap; width:90px; z-index:400; height:auto;}
#nav li:hover > ul ul
{position:absolute; left:-9999px; top:-9999px; width:0; height:0; margin:0; padding:0; list-style:none;}
#nav li:hover li:hover > a.fly
{background:#3f96a9 url(images/arrow_over.gif) 80px 6px no-repeat; color:#fff; border-color:#fff;}
#nav li:hover li:hover > li a.fly
{background:#50b5d0 url(images/arrow.gif) 80px 6px no-repeat; color:#000; border-color:#50b5d0;}
Kod:
<ul id='nav'>
<li class='top'><a href='".BASEDIR."news.php' class='top_link'><span>Strona główna</span></a></li>
<li class='top'><a href='/forum' class='top_link'><span>Forum</span></a></li>
<li class='top'><a href='/forum/viewforum.php?f=7' class='top_link'><span>Liga typerów</span></a></li>
<li class='top'><a href='/photogallery.php' class='top_link'><span>Galeria</span></a></li>
<li class='top'><a href='/contact.php' class='top_link'><span>Kontakt</span></a></li>
</ul>
Odpowiedz
#5
Dzięki, do zamknięcia.
Odpowiedz


Podobne wątki…
Wątek: Autor Odpowiedzi: Wyświetleń: Ostatni post
  problem z tłem pod menu loose 1 3,157 06-07-2017, 20:00
Ostatni post: loose
  problem z menu p410 10 10,361 18-06-2017, 18:34
Ostatni post: lemans88
  CSS dla menu i problem z selektorami neferith 4 5,269 30-06-2016, 00:58
Ostatni post: Brain23
  MENU - poważny problem wysokości! asus 0 2,539 05-12-2014, 23:34
Ostatni post: asus
  Trzypoziomowe menu - problem rejcz 3 5,678 25-01-2014, 17:16
Ostatni post: Kartofelek

Skocz do:


Użytkownicy przeglądający ten wątek:
Sponsorzy i przyjaciele
SeoHost.pl