samedi 5 mai 2012

Menu feito com CSS

Transições do CSS3 e pseudo-elementos do CSS2 formam um menu de navegação animado. O IE8 e IE9 não suportam as transições do CSS3, portanto, o menu não terá animação nesses navegadores.


HTML

<div class='menuCSS'>
    <a href="http://c-lien.blogspot.com/?Iw=="><span>Início</span></a>
    <a href="http://c-lien.blogspot.com/?Iw=="><span>Sobre</span></a>
    <a href="http://c-lien.blogspot.com/?Iw=="><span>Serviços</span></a>
    <a href="http://c-lien.blogspot.com/?Iw=="><span>Contato</span></a>
</div>

CSS

.menuCSS {
    display:inline-block;
}

.menuCSS:after, .menuCSS:before {
    margin-top:0.5em;
    content: "";
    float:left;
    border:1.5em solid #FFF;
}

.menuCSS:after {
    border-right-color:transparent;
}

.menuCSS:before {
    border-left-color:transparent;
}

.menuCSS a:link, .menuCSS a:visited {
    color:#000;
    text-decoration:none;
    float:left;
    height:3.5em;
    overflow:hidden;
    font-family:Arial;
}

.menuCSS span {
    background:#FFF;
    display:inline-block;
    line-height:3em;
    padding:0 1em;
    margin-top:0.5em;
    position:relative;
    -webkit-transition: background, margin 0.2s;  /* Saf3.2+, Chrome */
    -moz-transition: background, margin 0.2s;  /* FF4+ */
    -ms-transition: background, margin 0.2s;  /* IE10 */
    -o-transition: background-color, margin-top 0.2s;  /* Opera 10.5+ */
    transition: background, margin 0.2s;
}

.menuCSS a:hover span {
    background:#FFD204;
    margin-top:0;
}

.menuCSS span:before {
    content: "";
    position:absolute;
    top:3em;
    left:0;
    border-right:0.5em solid #9B8651;
    border-bottom:0.5em solid #fff;
}

.menuCSS span:after {
    content: "";
    position:absolute;
    top:3em;
    right:0;
    border-left:0.5em solid #9B8651;
    border-bottom:0.5em solid #fff;
}

Aucun commentaire:

Enregistrer un commentaire