html - 如何将上填充添加到一组链接图像

标签 html css

我的网站有以下代码,我正在尝试向网页上的图像链接组添加填充

<ul class="">
        <a href="https://www.github.com">
          <img style="height:auto; width:auto; max-width:50px; max-height:50px;" src="images/github.png" border="0" alt="Code" class="">
        </a>
        <a href="http://www.linkedin.com">
          <img style="height:auto; width:auto; max-width:50px; max-height:50px;" src="images/linkedin.png" border="0" alt="Connect" class="">
        </a>
        <a href="https://www.twitter.com">
          <img style="height:auto; width:auto; max-width:50px; max-height:50px;" src="images/twitter.png" border="0" alt="Twitter">
        </a>
      </ul>

我还有以下 CSS:

a{
    color:black;
    text-decoration: none;
  margin: 0px auto;
  width: 400px;
}
ul{
    padding: 0;
}

要在我的网站的群组图片链接上添加垂直填充,我需要做什么?

最佳答案

不确定这是你想要的,但尝试使用 padding-top:

ul a img {
    padding-top: 10px;  /* Change the value according to your needs */  
}

顺便说一句,您应该为您的元素赋予类以更具体地定位它。

关于html - 如何将上填充添加到一组链接图像,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/21656042/

相关文章:

html - 避免为 html 设置全局类

css - 为什么这些 div 相互排斥?

php - 如何获取链接标签的href内容

html - 如何只选择另一个 div 的所有第一个 child

javascript - Angular 指令 ng-repeat 输入将焦点设置为使用添加按钮添加的新选项

html - HTML 上的 Excel 预览

css - 使用 Sass/Less 和 Live Css 编辑

html - 基本 :nth-child cunfusion

html - PNG 或 CSS 图标 - 哪个性能更好?

javascript - 为动态对象添加类名