Forums » CGI & CSS

CRIANDO MENUS APENAS COM CSS – VERTICAL

    • 467 posts
    31 de julho de 2013 19:48:24 ART

    CRIANDO MENUS APENAS COM CSS – VERTICAL

    Continuando os posts de como se criar menus com CSS, dessa vez vou ensinar o menu vertical. Não tem muita diferença do horizontal, mas vamos lá.

    Usarei a mesma estrutura do menu anterior:

     

    <ul class="menu">
    <li><ahref="#"title="Macarrão">Macarrão</a></li>
    <li><ahref="#"title="Molho">Molho</a></li>
    <li><ahref="#"title="Almôndegas">Almôndegas</a></li>
    <li><ahref="#"title="Tomate">Tomate</a></li>
    </ul>

     

    Agora é onde realmente muda:

     
    .menu{
        width:250px;
        margin:0auto;
        list-style:none;/* retirando as bolinhas da LI */
        border:1pxsolid#ccc;
    }
    .menu li{
        width:250px;
        background:#f1f1f1;
        border-bottom:1pxsolid#ccc;
        border-top:1pxsolid#fff;
    }
    .menu li:first-child{
        border-top:none;
    }
    .menu li:last-child{
        border-bottom:none;
    }
    .menu lia{
        font:normal40014px/25pxArial,Helvetica,sans-serif;
        color:#666;
        text-decoration:none;
        display:block;
        padding:10px25px10px25px;
    }
    .menu lia:hover{
        color:#fff;
        background:#ccc;
    }
    .menu lia:focus{
        color:#0DACFF
    }
    .menu lia:active{
        background:#333;
    }

    Retiramos o ‘float’ das ‘li’ para que elas não fiquem umas do lado das outras, definimos o ‘width’ necessário para o local que o menu ficará, tanto na ‘ul’ quanto nas ‘li’.

    Adicionei também uma ‘border-top’ e uma ‘border-bottom’ para separar as ‘li’. Novamente com o código suprimido, podemos declará-lo também da seguinte forma:

     
    border-top-width:1px;
    border-top-style:solid;
    border-top-color:#ffffff;
     
    border-bottom:width:1px;
    border-bottom:style:solid;
    border-bottom-color:#cccccc;

    A propriedade ‘border’ pode ter os seguintes estilos:

    • Dotted: pontilhado
    • Dashed: tracejado
    • Solid: sólida
    • Double: dupla
    • Groove: sulco, cria uma borda ’3D’ (depende das cores aplicadas)
    • Ridge: cume, também cria uma borda ’3D’ (depende das cores aplicadas)
    • Inset: interna
    • Outset: externa

    Agora o que realmente é novo referente ao menu anterior, são as pseudo-classes ‘:first-child’ e ‘:last-child’ (primeiro filho e último filho, respectivamente).

    :first-child

    Esta pseudo-classe aplica as definições do CSS ao primeiro elemento filho do seletor.
    Ex.: Quero que o primeiro elemento ‘p’ da ‘div’ ‘#texto’ tenha o texto em vermelho.

     
    #texto p:first-child{
        color:#f00000;
    }

    :last-child

    Já esta pseudo-classe aplica as definições ao último elemento filho do seletor.
    Ex.: O último link da lista terá a cor verde.

     
    ul li:last-child{
        color:#00FF00;
    }
     
    <ul>
        <li>Lorem ipsum dolor sit amet,consectetuer adipiscing elit.</li>
        <li>Aliquam tincidunt mauris eu risus.</li>
        <li>Vestibulum auctor dapibus neque.</li>
        <li>Vestibulum auctor dapibus neque.</li>
        <li>Vestibulum auctor dapibus neque.</li>
        <li>Vestibulum auctor dapibus neque.</li>
    </ul>

     

    Lembre-se:
    :first-child e :last-child não tem completo suporte pelo Internet Explorer.

    :first-child ainda pode funcionar no Internet Explorer 8 com o devido ‘doctype’ declarado.

    :last-child não tem suporte pelo Internet Explorer, apenas pelos navegadores mais atuais como o Google Chrome, Mozilla Firefox, Safari e Opera.

    Portanto, ao usarem essas pseudo classes, tenham em mente que precisarão fazer um CSS somente para o Internet Explorer.

    Confira o menu funcionando [clique aqui]


    Este post foi editado por Oliveira Dario em 31 de julho de 2013 19:49:35 ART"
    • 3223 posts
    12 de janeiro de 2020 09:06:38 ART

    This website and I conceive this internet site is really informative ! Keep on putting up!   Language of Desires

    • 3223 posts
    12 de janeiro de 2020 09:28:25 ART

    I surely acquiring more difficulties from each surprisingly more little bit of it    Daily Health Series

    • 3223 posts
    13 de janeiro de 2020 07:36:36 ART

    I see the greatest contents on your blog and I extremely love reading them.      

    • 3223 posts
    13 de janeiro de 2020 07:54:44 ART

    very interesting post.this is my first time visit here.i found so many interesting stuff in your blog especially its discussion..thanks for the post!   Leptitox

    • 3223 posts
    14 de janeiro de 2020 01:22:57 ART

    I see the greatest contents on your blog and I extremely love reading them.     Flat Belly Fix

    • 3223 posts
    14 de janeiro de 2020 01:46:19 ART

    I surely acquiring more difficulties from each surprisingly more little bit of it    Truth or Dare

    • 3223 posts
    14 de janeiro de 2020 12:04:33 ART

    I see the greatest contents on your blog and I extremely love reading them.  Mind Body Matrix Pain Relief Cream

    • 3223 posts
    15 de janeiro de 2020 10:25:01 ART

    Very nice article. I enjoyed reading your post. very nice share. I want to twit this to my followers. Thanks !.    The Underdog Advantage

    • 3223 posts
    15 de janeiro de 2020 10:43:05 ART

    I see the greatest contents on your blog and I extremely love reading them.   Knowledge Broker Blueprint

    • 3223 posts
    16 de janeiro de 2020 11:48:39 ART

    Hi! This is my first visit to your blog! We are a team of volunteers and new initiatives in the same niche. Blog gave us useful information to work. You have done an amazing job!    Would You Rather

    • 3223 posts
    16 de janeiro de 2020 12:23:07 ART

    I surely acquiring more difficulties from each surprisingly more little bit of it  Clickbank University

    • 3223 posts
    18 de janeiro de 2020 08:09:28 ART
    Best Perfumes for Women I’ve been searching for some decent stuff on the subject and haven't had any luck up until this point, You just got a new biggest fan!..
    Este post foi editado por lifetime lifetime em 18 de janeiro de 2020 08:10:11 ART"
    • 3223 posts
    18 de janeiro de 2020 08:48:58 ART

    I feel really happy to have seen your webpage and look forward to so many more entertaining times reading here. Thanks once more for all the details.  Best Watches for Women

    • 3223 posts
    19 de janeiro de 2020 09:40:18 ART

    This website and I conceive this internet site is really informative ! Keep on putting up!   Spray foam insulation

    • 33 posts
    6 de fevereiro de 2020 14:25:31 ART

    Microsoft Outlook Thank you for posting such an interesting article. I thoroughly love reading it. Looking forward to reading more of your stuff. But if you need any microsoft email then contact the microsoft outlook website. Here we solve all microsoft outlook email problems.

    • 3223 posts
    8 de fevereiro de 2020 04:50:27 ART

    I see the greatest contents on your blog and I extremely love reading them.    Nature Crave Keto

    • 3223 posts
    8 de fevereiro de 2020 05:25:04 ART

    I surely acquiring more difficulties from each surprisingly more little bit of it   Nature Crave Keto

    • 3223 posts
    8 de fevereiro de 2020 05:28:15 ART

    I am very enjoyed for this blog. Its an informative topic. It help me very much to solve some problems. Its opportunity are so fantastic and working style so speedy.   Nature Crave Keto

    • 10 posts
    27 de fevereiro de 2020 06:30:00 ART

    Your time is limited, so don’t waste it living someone else’s life. Don’t be trapped by dogma, which is living with the results of other people’s thinking. Don’t let the noise of others’ opinions drown out your own inner voice. And most important, have the courage to follow your heart and intuition.  friv

    • 3 posts
    14 de março de 2020 15:25:40 ART
    Wow! Such an amazing and helpful post this is. I really really love it. It's so good and so awesome. I am just amazed. I hope that you continue to do your work like this in the future also.
    pure natural keto burn pills
     
    • 3 posts
    16 de março de 2020 15:12:20 ART
    Awesome blog. I enjoyed reading your articles. This is truly a great read for me. I have bookmarked it and I am looking forward to reading new articles. Keep up the good work!
    pure natural keto burn pills
    • 3 posts
    18 de março de 2020 20:05:00 ART
    I will really appreciate the writer's choice for choosing this excellent article appropriate to my matter.Here is deep description about the article matter which helped me more.
    http://adeleweightloss.com/sunset-keto/
     
    • 9 posts
    6 de abril de 2020 14:07:24 ART
    I would like to thank you for the efforts you have made in writing this article. I am hoping the same best work from you in the future as well. In fact your creative writing abilities has inspired me to start my own BlogEngine blog now. Really the blogging is spreading its wings rapidly. Your write up is a fine example of it.
    apk chest
     
    • 9 posts
    6 de abril de 2020 14:07:34 ART
    I would like to thank you for the efforts you have made in writing this article. I am hoping the same best work from you in the future as well. In fact your creative writing abilities has inspired me to start my own BlogEngine blog now. Really the blogging is spreading its wings rapidly. Your write up is a fine example of it.
    apk chest