How to make an hypertext link on a list that contains “material-icons”?

百般思念 提交于 2020-01-06 02:31:05

问题


I want to develop a floating bar that contains icons (material-icons). Unfortunately, my <a href=> attribute doesn't work and the icons are not clickable.

Any idea how to solve this?

<link href="https://fonts.googleapis.com/icon?family=Material+Icons" rel="stylesheet">
<ul id="navigation">
  <li class="material-icons md-48 md-dark">video_library
    <a href="https://www.google.com"></a>
  </li>
  <li class="material-icons md-48 md-dark">contact_support
    <a href="https://www.google.com" target="_blank"></a>
  </li>
  <li class="material-icons md-48 md-dark">mail
    <a href="https://www.google.com" target="_blank"></a>
  </li>
</ul>

回答1:


The text needs to be inside the link and the classes applied to those links...not the li.

li {
  list-style: none;
  display: inline;
}

a {
  text-decoration: none;
}
<link href="https://fonts.googleapis.com/icon?family=Material+Icons" rel="stylesheet">
<ul id="navigation">
  <li>
    <a href="https://www.google.com" class="material-icons md-48 md-dark">video_library</a>
  </li>
  <li>
    <a href="https://www.google.com" target="_blank" class="material-icons md-48 md-dark">contact_support</a>
  </li>
  <li>
    <a href="https://www.google.com" target="_blank" class="material-icons md-48 md-dark">mail</a>
  </li>
</ul>



回答2:


By setting icon inside <a>

 <li>video_library
        <a href="https://www.google.com"><i class="material-icons md-48 md-dark">video_library</i></a>
    </li>


来源:https://stackoverflow.com/questions/58973566/how-to-make-an-hypertext-link-on-a-list-that-contains-material-icons

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!