随机<a>&#39;s created in unordered list </a> <ul> <a>

时间:2018-09-01 11:16:52

标签: html html5

I have an < ul> list for a top menu bar which works fine, all the links are just text. However, I've recently tried to add two < li> items with an < img> tag inside them.

When a browser loads the page it creates random empty < a> tags in between the items which causes a gap. I've never seen this before.

<nav class="main-nav">
    <ul>
        <li><a href="*****.php">Home</a></li>       
        <li><a href="*****.php">*****</a></li> 
        <li><a href="*****.php">*****</a></li>
        <li><a href="*****.php">*****</a></li>
        <li><a href="*****.php">*****</a></li>
        <li><a href="*****.php">*****</a></li>
        <li><a href="*****.php">*****</a></li>
        <li><a href="*****.php">*****</a></li> 
        <li><a href="*****.php">*****</a></li>
        <li><a href="http://m.me/*****"><img style="max-width:50px;" src="/img/logo/fb1.png"><a/></li>
        <li><a href="https://www.tripadvisor.co.uk/*****"> <img style="max-width:60px;" src="/img/logo/trip.png"><a/></li>     
   </ul>    
</nav>

Here is the picture

Picture

1 个答案:

答案 0 :(得分:1)

用这一个代替最后2 li

<li><a href="http://m.me/*****"><img style="max-width:50px;" src="/img/logo/fb1.png"></a></li>
<li><a href="https://www.tripadvisor.co.uk/*****"> <img style="max-width:60px;" src="/img/logo/trip.png"> </a> </li>  

您使用的是<a/>而不是引起问题的</a>