0
It is possible to visualize that the <a>
is clickable ie, I click on it and it redirects me to another location for example, but I would like to know how I do so that it is possible to click anywhere from <li>
to take place the redirect and not only in the <a>
ul {
list-style-type: none;
text-align:center;
}
ul li {
width: 200px;
height: 50px;
border: 1px solid black;
}
ul li:hover {
background: gray;
}
<ul>
<li> <a href="#"> Um </a> </li>
<li> <a href="#"> Dois </a> </li>
<li> <a href="#"> Tres </a> </li>
</ul>
No matter where I click inside the <li>
he would execute the href
within the <a>
That’s kind of a gambit right? Not according to the semantics right?
– Bruno Silva
I don’t know, we have image link, div link and so on. It works?
– user60252
I’m not talking about the link itself but about the way to fill the <li>, I’ll see if I can find another method, that I use <li> </a> </a> </li> and can perform this task, if I can’t get it right in your answer! Thanks for the help.
– Bruno Silva
Do so: <li onclick="Location.href = 'https://answall.com/';">click</li>
– user60252
The element
ul
wait onlyli
as children. Any other element breaks semantics and leaves HTML invalid according to W3C. Although it usually works due to current implementations of browsers, it is highly recommended that this be avoided, since browsers can fix this at any time and which search system penalizes the page for not being the standards.– Woss
@Andersoncarloswoss, convincing explanation, I edited question
– user60252