CSS problem, does not work

Asked

Viewed 962 times

0

Some CSS commands are not working.

Follow the commands:

HTML

 <section class="menu-departamentos"><!-- inicio .menu-departamentos -->

<h2>Departamentos</h2>

<nav>
                <ul>
                    <li><a href="#">Blusas e Camisas</a></li>
                        <ul>
                                        <li><a href="#">Manga curta</a></li>
                                        <li><a href="#">Manga cumprida</a></li>
                                        <li><a href="#">Camisa social</a></li>
                                        <li><a href="#">Camisa casual</a></li>
                        </ul>
                    <li><a href="#">Calças</a></li>
                    <li><a href="#">Saias</a></li>
                    <li><a href="#">Vestidos</a></li>
                    <li><a href="#">Sapatos</a></li>
                    <li><a href="#">Bolsas e Carteiras</a></li>
                    <li><a href="#">Acessórios</a></li>
                </ul>
</nav>

</section><!-- fim .menu-departamentos -->

CSS

   a[href^=http://]:after {
  content: '(externo)';
}


li ul {
    display: none;
}

You don’t do what you’re supposed to do, I can put color:red; the second nothing happens.

Nothing I put between keys works with the li ul separated by space, only works if I separate them by comma li,ul.

Can anyone tell me why?

I’ve tested with Chrome and Sapphire, both updated.

I use the Sublime Text.

Goal

Remove the submenu of Blouses and Shirts using display:none; in the CSS

  • Post HTML too. But then, it’s wrong.

  • @Diegosouza I put the HTML and a few more explanations, if you can help me, I appreciate.

2 answers

1

Correction

Friend of mine discovered the problem (it was right under my eyes).

Follows the correction:

    <ul>
         <li><a href="#">Blusas e Camisas</a></li> <!-- Esse </li> era o erro. -->
             <ul>
                  <li><a href="#">Manga curta</a></li>
                  <li><a href="#">Manga cumprida</a></li>
                  <li><a href="#">Camisa social</a></li>
                  <li><a href="#">Camisa casual</a></li>
             </ul>

<!-- Aqui embaixo do </ul> deveria fechar o </li>, para o  css identificar que é um submenu -->

         <li><a href="#">Calças</a></li>

    </ul>

Correct code:

    <ul>
         <li><a href="#">Blusas e Camisas</a>
             <ul>
                  <li><a href="#">Manga curta</a></li>
                  <li><a href="#">Manga cumprida</a></li>
                  <li><a href="#">Camisa social</a></li>
                  <li><a href="#">Camisa casual</a></li>
             </ul>
         </li>  
         <li><a href="#">Calças</a></li>

    </ul>

CSS

ul li ul{
    display:none;
}

Motive

The reason the code wasn’t working was because I didn’t close the submenu read as explained above.

Thanks

Thank you to all who tried in some way to help me solve the problem, which in this case was my lack of attention to the code. I totally ignored proofreading the HTML.

Let learning for future readers of this topic, if your CSS does not work, look to revise your HTML, it may be wrong, What can influence when trying to use CSS.

-1

li ul 

The above command is not sequence, so if you do this will not work at all.

It would be right:

ul li

Because in the HTML that’s how it is:

<ul>
   <li> 1 </li>
   <li> 1 </li>
   <li> 1 </li>
</ul>

If comma separation will work, because CSS doesn’t understand sequence but as separate tags.

ul, li = li, ul

  • You were the one who came closest to solving the problem. ’s my code is this, I want the "submenu" of Blouses and T-shirtsdoes not appear. follows the Code:

  • 1

    But what’s your problem? I explained to you why it’s not working what you want.

  • I put the HTML and some more explanations, if you can help me, I appreciate.

  • css uses cascading elements, you could do it in two ways: 1ª: ul li ul li {display:None}; 2nd: you could add a class in the <li> or <ul> you want to hide and the css reference it. Example: HTML:<li><a class='submenu' href="#">Short sleeve</a></li> or HTML:<ul class='submenu' >...</ul> CSS: . submenu{display:None;}

  • Why was I negative ? Cool it, huh! The guy asks a bad question, I try to help, I still ask him to post more things. Then comes someone and negative.

Browser other questions tagged

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