5
I always have that question, look at that:
I have a menu, with ul and li:
<ul>
<li><a href="/inicio">Inicio</a></li>
<li><a href="/sobre">Sobre</a></li>
<li><a href="/contato">Contato</a></li>
</ul>
How do I, so when I position or click on li
the link to a
work? Because, for example, it only works if I click on a
, but, if I click off, in case, on li
, does not work, the link a
non-active.
This answer should be marked as the correct one.
– Oralista de Sistemas
Could you explain, Renan, the answer of Evandro? In several places I looked, I was told to do it his way. Because if not, every menu I create, I’ll have to make a script.
– Lucas de Carvalho
@Lucascarvalho Mathias' response only needs to be applied once to the entire site, so it does not require repetition. Evandro’s response does not seem ideal because it engages application behavior in her style. You can introduce a bug into your system just by changing the CSS.
– Oralista de Sistemas
For example, here in Sopt, in the menu, the tag a is inline-block, this is not ideal in the case?
– Lucas de Carvalho
@Lucascarvalho inline-block allows you to set a width to tag "a" and at the same time put an item next to each other, Sopt’s solution is correct too, and in my view none of this changes the behavior of the application as Renan states, it only changes the style, and if you run the site without CSS the links will work normally, and the code will be validated as correct in any HTML validator. This debate here proves that there are several ways to solve the same problem, some simple, some more complex and some not recommended. But maybe only Mr. Tim Bernes Lee knows the right one
– Evandro Klimpel Balmant