I have a group of images which each have their own links. I want the images to be in a list (<ul><li>
.. etc) and have each item have a different background-image
.
Would I run into any issues with something like this?
<ul>
<a href="#"><li class="1"></li></a>
<a href="#"><li class="2"></li></a>
<a href="#"><li class="3"></li></a>
<a href="#"><li class="4"></li></a>
<a href="#"><li class="5"></li></a>
<a href="#"><li class="6"></li></a>
</ul>
You would do better to write it like this
Then you could add the
background-image
to either thea
or theli
.However, you would style the
a
s asdisplay:block
and give them the sameheight
andwidth
of theli
. That way the background-image would show and the entireli
would be clickable.It is not valid HTML because the only thing allowed in an
<ul>
element is<li>
s.It's not valid HTML.