css - 在移动 View 中连续显示社交图标

标签 css icons row

我希望我的社交图标在移动 View 中处于行方向(左侧)。在桌面 View 中,图标应该位于一列的最右侧,我使用 float:right 做到了这一点,但是我应该更改什么才能使它们位于左侧的水平线(内联)中? 这是我的 html:

 <div class="socialico">
            <div id="social-test">
                    <ul class="social">
                      <li><a class = "facebook" href="https://www.facebook.com/bay42.io/"><i class="fa fa-facebook" aria-hidden="true"></i></a></li>
                      <li><a class = "instagram" href="https://www.instagram.com/bay42.io/"><i class="fa fa-instagram" aria-hidden="true"></a></i></li>
                      <li><a class = "linkedin" href="https://www.linkedin.com/company/bay42-banja-luka/"><i class="fa fa-linkedin" aria-hidden="true"></i></a></li>
                    </ul>
            </div> <!--social-test div-->
    </div>

这是我的 CSS:

.socialico{
             position: relative;
             float: right;
             margin-top: -8%;
             color: #fff;
             animation: slideInRight 1.5s;
            } 
         #social-test ul li{
             padding-bottom: 10px;
        }
        .socialico ul li a:hover{  
    color: #C8A962;
    animation: bounceIn 6s;
        }
        .socialico ul li a { 
    color:#fff;
}

此外,这是我的移动 View CSS:

.socialico{

            position: relative;
            float:left;
            margin-top: -8%;
            color: #fff;
            animation: slideInRight 1.5s;
           } 
        #social-test ul li{
            display: inline-block;
       }
       .socialico ul li a:hover{  
   color: #C8A962;
   animation: bounceIn 6s;
       }
       .socialico ul li a { 
   color:#fff;
   display: inline-block;

}

最佳答案

您需要做的就是将 ul 显示设置为 flex 并将 flex-direction 设置为 row.

CSS:

@media only screen and (max-width: 576px) {
  .socialico {
    float: left;
  }
  #social-test ul {
    display: flex;
    flex-direction: row;
    flex-wrap: nowrap;
  }
}

关于css - 在移动 View 中连续显示社交图标,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/58507268/

相关文章:

html - 如何在 HTML 中将模式框定位在浏览器之外?

Android:如何更改操作栏选项卡中的图标大小?

windows - TortoiseSVN 图标在 Windows 7 下不显示

mysql - 更新数据表中的行

apache-flex - 在 datagrid flex 中创建一个 "total"列

CSS 过渡 : Div does not move back to its original place

html - 尝试在添加按钮单击时添加 "choose file and remove button"时 Bootstrap 面板主体对齐问题

css - 为什么 z-index 较高的 div 不可见(被覆盖)?

html - 如何为 Font Awesome 图标的透明区域添加颜色

javascript - 使用 jQuery 检索表中的上一行和下一行