tutorials.de Buch-Aktion 05/2012
Like Tree1Danke
  • 1 Beitrag von spicelab
ERLEDIGT
JA
ANTWORTEN
3
ZUGRIFFE
351
EMPFEHLEN
  • An Twitter übertragen
  • An Facebook übertragen
AUF DIESES THEMA
ANTWORTEN
  1. #1
    Avatar von Alex_T
    Alex_T Alex_T ist offline Mitglied Brokat
    Registriert seit
    Jul 2009
    Beiträge
    311
    Hallöle,

    ich habe da mal eine bescheidene Frage. Folgendes:
    Wie bekomme ich es hin, dass wenn ich über die Unterpunkte im Menü fahre, der Hauptpunkt aus der eigentlichen Menüleiste verändert bleibt? Heißt - ich fahre mit der Maus über das Kindelement, jedoch soll auch das Elternelement verändert bleiben, solange ich mich in dessen "Unterliste" befinde.

    Hier mal mein Code:

    HTML-Code:
    <div id="menu">
         <ul>
        	<li><a href='http://localhost/AT/index.php?Content_NAV=Startseite' <?php if($Content == "Startseite") {echo" style='color:#FFF;'";} ?>><center>Startseite</center></a></li>
        </ul>
        <ul>
    		<li><a href='http://localhost/AT/Switch.php?Content=Liga&Content_NAV=Programme'	<?php if($Content == "Programme") {echo" style='color:#FFF;'";} ?>><center>Programme</center></a></li>
        </ul>
        <ul>
        	<li><a href='#' <?php if($Content == "Downloads") {echo" style='color:#FFF;'";} ?>><center>Downloads</center></a>
                <ul>
                <li><a href='http://localhost/AT/Switch.php?Content=Programme_D&Content_NAV=Downloads'>Programme</a></li>
                <li><a href='http://localhost/AT/Switch.php?Content=Patches_D&Content_NAV=Downloads'>Patches</a></li>
                </ul>
             </li>
         </ul>
         <ul>   			
        	<li><a href='#' <?php if($Content == "Support") {echo" style='color:#FFF;'";} ?>><center>Support</center></a>
                <ul>
                <li><a href='http://localhost/AT/Switch.php?Content=FAQ&Content_NAV=Support'>FAQ</a></li>
                <li><a href='http://localhost/AT/Switch.php?Content=Kontakt&Content_NAV=Support'>Kontakt</a></li>
                </ul>
            </li>
         </ul>
         <ul>
        	<li><a href='#' <?php if($Content == "Community") {echo" style='color:#FFF;'";} ?>>Community</a>
                <ul>
                <li><a href='http://localhost/AT/Switch.php?Content=Kontakt&Content_NAV=Community'>Forum</a></li>
                </ul>
            </li>
        </ul>
    </div>
    ...und das dazugehörige Stylesheet:

    Code :
    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
    
    #menu {
    width: 500px;
    background: #414141;
    float: left;
    }
    #menu ul {
    list-style: none;
    margin: 0;
    padding: 0;
    width: 100px;
    float: left;
    }
     
    #menu a {
    font: bold 11px/16px arial, helvetica, sans-serif;
    display: block;
    background-color:#4b4b4b;
    margin: 0;
    padding: 2px 3px;
    text-decoration:none;
    color:#7a7a7a;
    height:45px;
    line-height:45px;
    outline:0;
    }
     
    #menu a:hover {
    color: #FFF;
    background-image:url(Bilder/Button_hover.jpg);
    }
     
    div#menu ul ul {
    display: none;
    }
     
    div#menu ul li:hover ul
    {display: block;}
     
    #menu ul ul {
    position: absolute;
    z-index: 500;
    border:1px solid #aaaaaa;
    border-top:none;
    width:150px;
    }
     
    #menu ul ul a {
    color:#FFF;
    text-decoration:none;
    height:25px;
    line-height:25px;
    padding-left:30px;
    }
     
    #menu ul ul a:hover {
    color:#FFF;
    text-decoration:none;
    background-color:#7a7a7a;
    background-image:none;
    height:25px;
    }

    Hoffe ich konnte mein Problem ausführlich schildern und bedanke mich schon jetzt für Eure Bemühungen.
     
    Mfg, Alex

    “The function of good software is to make the complex appear to be simple.” (Grady Booch)
    “First, solve the problem. Then, write the code.” (John Johnson)

  2. #2
    Avatar von spicelab
    spicelab spicelab ist offline ZENmechanic
    Registriert seit
    Feb 2010
    Beiträge
    1.744
    Der zweite Selektor #menu ul li:hover a sorgt dafür:

    Code css:
    1
    2
    3
    4
    
    #menu a:hover, #menu ul li:hover a {
    color: #FFF;
    background-image:url(Bilder/Button_hover.jpg);
    }
    Geändert von spicelab (05.08.10 um 17:21 Uhr)
    Alex_T bedankt sich. 

  3. #3
    Avatar von Alex_T
    Alex_T Alex_T ist offline Mitglied Brokat
    Registriert seit
    Jul 2009
    Beiträge
    311
    Großartig - ich danke dir vielmals.
     
    Mfg, Alex

    “The function of good software is to make the complex appear to be simple.” (Grady Booch)
    “First, solve the problem. Then, write the code.” (John Johnson)

  4. #4
    Avatar von spicelab
    spicelab spicelab ist offline ZENmechanic
    Registriert seit
    Feb 2010
    Beiträge
    1.744
    Gern geschehen.

    Und wähle das nächste Mal einen trefferenden Themenbetreff, der die Frage / das Problem auf den Punkt bringt, denn bei einem vertikalen Menü würde die Lösung hier gleichermaßen lauten.
     

Ähnliche Themen

  1. Horizontales Menü IE7
    Von dobber812 im Forum CSS
    Antworten: 1
    Letzter Beitrag: 03.02.10, 17:47
  2. Horizontales Menü / IF-IE 5,6 +7
    Von dobber812 im Forum CSS
    Antworten: 6
    Letzter Beitrag: 23.11.09, 10:13
  3. Dynamsiches horizontales Menü
    Von Fullku im Forum CSS
    Antworten: 1
    Letzter Beitrag: 23.06.08, 12:23
  4. Horizontales Menü (ohne JS/htc) ?
    Von soyo im Forum CSS
    Antworten: 40
    Letzter Beitrag: 14.12.06, 14:17
  5. horizontales Menü mit CSS
    Von [desty] im Forum CSS
    Antworten: 2
    Letzter Beitrag: 23.05.06, 20:35