Ocena wątku:
  • 0 głosów - średnia: 0
  • 1
  • 2
  • 3
  • 4
  • 5
3rd level css menu problem
#1


Załączone pliki
.png   drop.png (Rozmiar: 24.66 KB / Pobrań: 10)
Odpowiedz
#2
CSS: line 197
You set position to relative. Delete this and leave position:absolute (you set this in 216).
Odpowiedz
#3


Załączone pliki
.jpg   drop2.jpg (Rozmiar: 79.79 KB / Pobrań: 5)
Odpowiedz
#4
add this to your css:
Kod:
.topmenu .level2 {position:relative;}
OR
Kod:
.topmenu li {position:relative;}

Element with position:absolute is positioned to the first parent element with position:relative
Odpowiedz
#5
(30-04-2012, 03:17)kornell napisał(a):
(30-04-2012, 00:20)Kartofelek napisał(a): add this to your css:
Kod:
.topmenu .level2 {position:relative;}
OR
Kod:
.topmenu li {position:relative;}

Element with position:absolute is positioned to the first parent element with position:relative

check this out

http://css-tricks.com/absolute-positioning-inside-relative-positioning/



Thank you both for your help the link to the positioning article has help me understand more.

However I have tried all combination of relative and absolute I can think of and none of them work.

The menu is in a clearfix class does this makes any difference ? here is the html code
Kod:
<?php if (!defined('CMS')) exit; ?>
<?php echo $this->doctypeDeclaration(); ?>

<html<?php echo $this->htmlAttributes(); ?>>
<head>
<?php
    $site->addCss(BASE_URL.THEME_DIR.THEME.'/960.css');
    $site->addCss(BASE_URL.THEME_DIR.THEME.'/site.css');
    $site->addCss(BASE_URL.THEME_DIR.THEME.'/ip_content.css');
    $site->addCss(BASE_URL.LIBRARY_DIR.'js/colorbox/themes/2/colorbox.css');
    echo $site->generateHead();
?>
    <!--[if lt IE 9]>
        <script src="http://html5shim.googlecode.com/svn/trunk/html5.js"></script>
    <![endif]-->
</head>
<body<?php if ($site->managementState()) { echo ' class="manage"'; } ?>>

    <div class="container_12 wrapper">
        <header class="grid_12">
                <img class="sitename" src="<?php echo BASE_URL.THEME_DIR.THEME; ?>/img/logo.png">
            <div class="languages">
                <?php echo $site->generateBlock('ipLanguages'); ?>
            </div>
            <?php echo $site->generateBlock('ipSearch'); ?>
            <img class="banner" src="<?php echo BASE_URL.THEME_DIR.THEME; ?>/img/header.jpg" alt="">
            <div class="topmenu clearfix">
                <?php
                    require_once (BASE_DIR.LIBRARY_DIR.'php/menu/common.php');
                    $menuTop = new Library\Php\Menu\Common();
                    echo $menuTop->generateSubmenu('top', null, 3); //$zoneName, $parentElementId, $depthLimit
                ?>
            </div>
        </header>
        <div class="main grid_9 right">
            <div class="breadcrumb">
               <?php echo $site->generateBlock('ipBreadcrumb'); ?>
            </div>
            <?php echo $site->generateBlock('main'); ?>
        </div>
        <div class="side grid_3 left">
            <nav class="collapse"><?php /* add class="collapse" to <nav> to hide second level by default */ ?>
                <?php
                    require_once (BASE_DIR.LIBRARY_DIR.'php/menu/common.php');
                    $menuTop = new Library\Php\Menu\Common();
                    echo $menuTop->generate('top');
                    echo $menuTop->generate('top', 2, 3);  //$zoneName, $parentElementId, $depthLimit
                ?>
            </nav>
            <aside>
                <?php echo $site->generateBlock('side'); ?>
            </aside>
        </div>
        <div class="clear"></div>
        <footer class="clearfix">
            <div class="grid_12 clearfix">
                <p class="left">Theme "LT pagan"</p>
                <p class="right">Drag &amp; drop with <a href="http://www.impresspages.org">ImpressPages CMS</a></p>
            </div>
        </footer>
    </div>
    <?php
        $site->addJavascript(BASE_URL.LIBRARY_DIR.'js/jquery/jquery.js');
        $site->addJavascript(BASE_URL.LIBRARY_DIR.'js/colorbox/jquery.colorbox.js');
        $site->addJavascript(BASE_URL.THEME_DIR.THEME.'/site.js');
        echo $site->generateJavascript();
    ?>
</body>
</html>

Both the css and the html are from a theme from a cms (impresspages.org). The original theme had a 2 level drop down. I modified the css for a 3 level drop down.

I had a look at this three level menu in a clearfix class:
http://css.find-info.ru/css/011/ch07lev1sec4.html

and there seems to be no relative or absolute positioning in the lower levels.

Now I am even more confused!!!

Alan
Odpowiedz
#6
Yep. they have position:relative

Kod:
<ul>
<li position:relative>
     <ul position:absolute right:0; top:0>
     <li pos:relative></li>
     <li pos:relative></li>
     <li pos:relative>
          <ul position:absolute right:0; top:0>
          <li pos:relative></li>
          <li pos:relative></li>
          <li pos:relative></li>
          </ul>
     </li>
     </ul>
</li>
<li position:relative></li>
</ul>
Odpowiedz
#7
Many many thanks to both of you, now the menu works at last. I will go back again and clean up the complete mess I had made of the file by chaning everything I could think of - a good learning experience for me !!!!

It was the

Kod:
.topmenu li {
    position: relative;
}

that made the difference. What threw me is that this line was not in the original code for the 2 level version of the menu that I modified.

Much appreciated.

Alan
Odpowiedz


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

Skocz do:


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