do a submenu - example on a site below

Asked

Viewed 17,721 times

-4

I’d like to adapt my code to create a submenu like this one : http://red-team-design.com/wp-content/uploads/2011/03/css3-dropdown-menu-demo.html for example in "Categories" - "css" then another side menu with the same properties as the one above appears and I would like mine to be like this.

<div id="menu2">
<ul id="menu">
    <li><a href="site.html">Pagina Inicial</a></li>
    <li>
        <a href="#">Produtos</a>
        <ul>        
            <li><a href="inserir.html">Inserir</a></li>
            <li><a href="#" class="last-child">Ver produtos no site</a>
            <ul>
                <li><a href="#">Caps</a></li>
                <li><a href="#">Camisas</a></li>
            </ul>
            <li><a href="procurar.html">Procurar</a></li>
            <li><a href="remover.html">Eliminar</a></li>
            <li><a href="listar.php">Listar</a></li>
        </ul>
    </li>
    <li>
    <a href="site.html">A nossa Empresa</a>
    <ul>
            <li><a href="empresa.html">Hist&oacute;ria</a></li>
            <li><a href="val.html">Valores</a></li>
            <li><a href="maps.html">Localização</a></li>
        </ul>
        </li>
    <li><a href="cont.html">Contactos</a>
    <ul>
        <li><a href="email.html">Contacte-nos </a></li>
        </ul>
        </li>

</ul>
</div>
<body background="fundo.jpg" >

#menu{

    width: 57%;
    margin: auto;
    padding: 15px 0 0 0;
    list-style: none;  
    background: #111;
    background: -moz-linear-gradient(#444, #111); 
    background: -webkit-gradient(linear,left bottom,left top,color-stop(0, #111),color-stop(1, #444));  
    background: -webkit-linear-gradient(#444, #111);    
    background: -o-linear-gradient(#444, #111);
    background: -ms-linear-gradient(#444, #111);
    background: linear-gradient(#444, #111);



}
#menu2{

    width:78%;
    border: medium none;
    float: center;
    text-decoration: none;
    margin: auto;
    background: #111;
    background: -moz-linear-gradient(#444, #111); 
    background: -webkit-gradient(linear,left bottom,left top,color-stop(0, #111),color-stop(1, #444));  
    background: -webkit-linear-gradient(#444, #111);    
    background: -o-linear-gradient(#444, #111);
    background: -ms-linear-gradient(#444, #111);
    background: linear-gradient(#444, #111);
    -moz-border-radius: 20px;
    border-radius: 50px;
    -moz-box-shadow: 0 2px 1px #9c9c9c;
    -webkit-box-shadow: 0 2px 1px #9c9c9c;
    box-shadow: 0 2px 1px #9c9c9c;

    }

.imagem:hover{
    box-shadow: 0 3px 22px #9c9c9c;
    width:60;
    height:60;
}
 .alinhar {
     position: relative; 
   width: 44%; 
    }

.alinhar form{
    position: absolute;
    top: -2em;
    width: 150px;
    padding: 20px;
    font-weight: bold;
    right:50px;

}

#bodyy{
        margin-top: -38px;
        margin-right: 350px;
        margin-left: 350px;
    background: #111;
    background: -moz-linear-gradient(#444, #111); 
        background: -webkit-gradient(linear,left bottom,left top,color-stop(0, #111),color-stop(1, #444));  
    background: -webkit-linear-gradient(#444, #111);    
    background: -o-linear-gradient(#444, #111);
    background: -ms-linear-gradient(#444, #111);
    background: linear-gradient(#444, #111);
    -moz-box-shadow: 0 2px 1px #9c9c9c;
    -webkit-box-shadow: 0 2px 1px #9c9c9c;
    box-shadow: 0 2px 1px #9c9c9c;

}
#btn {

  -webkit-border-radius: 28;
  -moz-border-radius: 28;
  border-radius: 28px;
  font-family: Courier New;
  font-size: 15px;
  background: #292c2e;
  padding: 13px 20px 10px 20px;
  text-decoration: none;
  float:left;


}

#btn:hover {
  background: #292c2e;
  cursor:hand;
    background: #fafafa;
    background: -moz-linear-gradient(#04acec,  #0186ba);    
    background: -webkit-gradient(linear, left top, left bottom, from(#04acec), to(#0186ba));
    background: -webkit-linear-gradient(#04acec,  #0186ba);
    background: -o-linear-gradient(#04acec,  #0186ba);
    background: -ms-linear-gradient(#04acec,  #0186ba);
    background: linear-gradient(#04acec,  #0186ba);
}



#menu li{

    float: left;
    padding: 0 0 20px 0;
    position: relative;



}

#menu a{
    float: left;
    height: 20px;
    padding: 0 45px;
    color: #999;
    text-transform: uppercase;
    font: bold 12px/25px Arial, Helvetica;
    text-decoration: none;
#menu li:hover > a{
    color: #fafafa;
}

*html #menu li a:hover{ /* IE6 */
    color: #fafafa;
}

#menu li:hover > ul{
    display: block;
}


/* Sub-menu */

#menu ul{
    list-style: none;
    margin: 0;
    padding: 0;    
    display: none;
    position: absolute;
    top: 35px;
    left: 0;
    z-index: 99999;    
    background: #444;
    background: -moz-linear-gradient(#444, #111);
    background: -webkit-gradient(linear,left bottom,left top,color-stop(0, #111),color-stop(1, #444));
    background: -webkit-linear-gradient(#444, #111);    
    background: -o-linear-gradient(#444, #111); 
    background: -ms-linear-gradient(#444, #111);    
    background: linear-gradient(#444, #111);    
    -moz-border-radius: 5px;
    border-radius: 5px;
}

#menu ul li{
    float: none;
    margin: 0;
    padding: 0;
    display: block;  
    -moz-box-shadow: 0 1px 0 #111111, 0 2px 0 #777777;
    -webkit-box-shadow: 0 1px 0 #111111, 0 2px 0 #777777;
    box-shadow: 0 1px 0 #111111, 0 2px 0 #777777;
}


#menu ul li:last-child{   
    -moz-box-shadow: none;
    -webkit-box-shadow: none;
    box-shadow: none;    
}

#menu ul a{    
    padding: 10px;
    height: auto;
    line-height: 1;
    display: block;
    white-space: nowrap;
    float: none;
    text-transform: none;

}


#menu ul a:hover{
        background: #0186ba;
    background: -moz-linear-gradient(#04acec,  #0186ba);    
    background: -webkit-gradient(linear, left top, left bottom, from(#04acec), to(#0186ba));
    background: -webkit-linear-gradient(#04acec,  #0186ba);
    background: -o-linear-gradient(#04acec,  #0186ba);
    background: -ms-linear-gradient(#04acec,  #0186ba);
    background: linear-gradient(#04acec,  #0186ba);
}


#menu ul li:first-child a{
    -moz-border-radius: 5px 5px 0 0;
    -webkit-border-radius: 5px 5px 0 0;
    border-radius: 5px 5px 0 0;
}

#menu ul li:first-child a:after{
    content: '';
    position: absolute;
    left: 50px;
    top: -8px;
    width: 0;
    height: 0;
    border-left: 5px solid transparent;
    border-right: 5px solid transparent;
    border-bottom: 8px solid #444;
}

#menu ul li:first-child a:hover:after{
    border-bottom-color: #04acec; 
}

#menu ul li:last-child a{
    -moz-border-radius: 0 0 5px 5px;
    -webkit-border-radius: 0 0 5px 5px;
    border-radius: 0 0 5px 5px;
}

/* Clear floated elements */
#menu:after{
    visibility: hidden;
    display: block;
    font-size: 0;
    content: " ";
    clear: both;
    height: 0;

}
  • I expect your reply as soon as possible Prf. Urgent

  • 6

    Hello, Welcome to [en.so]. Please read the guides [Ask] and [about]. You must demonstrate that you tried to solve the problem, we can help with the code but not write from scratch for you. And if it’s urgent, you better hire a professional.

  • 2

    The site you linked is a complete tutorial on how to do this!

1 answer

3

The answer to your question is in the example’s own website article you shared. Take a look at the present material at: CSS3 Dropdown Menu. The answer is there, already assembled and ready for use.

  • 2

    It is not the kind of response that deserves a positive vote (as it is link-only and can be converted to comment by a moderator). But in this case it is perfect +1+

Browser other questions tagged

You are not signed in. Login or sign up in order to post.