When trying to link a NAV, the CSS style gets messy

Asked

Viewed 76 times

-1

Good morning guys, I’m starting to learn front-end and I came across a problem I’d like to understand why it happens.

I’ve got that bit in my code:

       <div class="box-item">
            <div class="box-img">
                <img src="img/base-conhe-icon.png" alt="Icone de base de conhecimento"/>
            </div>
            <div class="box-desc">
                <h1>Documentação</h1>
                <p>.........</p>
            </div>
        </div>

This div is rendered this way:

inserir a descrição da imagem aqui

I want to link the entire parent DIV, but when I use the DIV wrapped tag, the result is this:

inserir a descrição da imagem aqui

Surely in my HTML and CSS there are redundant codes and maybe techniques that can be considered gambiarras, as I said, I’m learning. My biggest question is that without the tag , It is perfect, including responsive. Already with it, the div is disfigured.

HTML: https://pastebin.com/8QeAQHVZ CSS: https://pastebin.com/tWDEME6d

People, do not notice if you have mess or gambiarras, rsrs. In addition, I ask you to draw my attention to points that can be improved. Thanks!

  • 1

    You need to know the CSS to respond. Post the codes.

  • 1

    Guys, I edited the question, at the end of it has the codes on Pastebin.

1 answer

0


Basically just put your <a> thus: <a href="#" class="box-item"> and remove the <div class="box-item"> from within that <a>. So you will apply the styles directly on <a> who is now the direct son of <div class="conteudo-principal"> and will no longer need div from within

inserir a descrição da imagem aqui

  • Massa Hugo, thank you very much! The content is very messy Hugo? Do you have any improvement tips or something? rsrs The organization of HTML, CSS, etc.

  • @Ricardocássio one thing I realized without analyzing is that it’s too much CSS line theoretically for too little. Probably like you said there’s a lot of redundant stuff there... I’ll look and give you some tips if it’s within my reach

  • Oops, perfect. Thank you!

  • @Ricardocássio guy actually from the HTML part is all well organized, it’s great. Regarding the CSS I gave a slip here I had given Ctrl+v 2x, there seemed MUCH more rss code. Other than that, I saw that you commented and separated the CSS by parts that’s good. The tip I give you is to use less breacking points, you don’t need so many... and another thing is that you don’t have to repeat things to your face breacking points. Once you stated something in a breacking points I don’t know that you wanted to change something again, then you repeat the class and change whatever it is...

  • Like that doesn’t make sense @media screen and (max-width: 768px){&#xA; .nav-cab{&#xA; display: none;&#xA; } } and @media screen and (max-width: 480px){&#xA; .nav-cab{&#xA; display: none;&#xA; } } since you stated in the 768px no need to declare in the 480px understand. The nomenclature form of the classes tb is legal! You are on the right track, never stop studying 1

  • 1

    Thank you so much for the help, the tips and the incentive Hugo. Success!

Show 1 more comment

Browser other questions tagged

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