首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >我需要帮助对齐页面中心的图像链接。

我需要帮助对齐页面中心的图像链接。
EN

Stack Overflow用户
提问于 2019-10-02 01:19:55
回答 1查看 295关注 0票数 1

我想对齐图片链接到页面的中心。这就是我迄今尝试过的:

HTML:

代码语言:javascript
复制
<section id="Contact">
  <h1 class="other-section">Contact</h1>
  <div class="contact-links">
    <a id="profile-link" href="https://facebook.com/" target="_blank">
     <img src="https://image.flaticon.com/icons/svg/21/21155.svg" />
    </a>
    <a id="profile-link" href="https://github.com/jadenadams329" target="_blank">
       <img src="https://image.flaticon.com/icons/svg/25/25231.svg" />
     </a>
    <a id="profile-link" href="https://instagram.com" target="_blank">
       <img src="https://image.flaticon.com/icons/svg/87/87390.svg" /> 
    </a>
  </div>
</section>
      <script src="https://cdn.freecodecamp.org/testable-projects-fcc/v1/bundle.js"></script>

CSS:

代码语言:javascript
复制
#Contact {
    margin:0 auto;
    padding:3em 0 0 0;
    min-height:100vh;
    background-color: var(--contact-bg);
  }

.other-section{
    font-size: 30pt;
    text-align:center;
    color: #EDF5E1;
    margin-bottom: 10px;
 }
.contact-links{
      text-align: center;

    }
    #profile-link img{
      width: 50px;

    }

我不能为了我的生活,让他们停留在页面的中间,在接触下均匀地间隔。

EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2019-10-02 01:55:32

实际上,您可以使用内嵌块实现这一点。

代码语言:javascript
复制
:root{--contact-bg: white}
#Contact {
    margin:0 auto;
    padding:3em 0 0 0;
    min-height:100vh;
    background-color: var(--contact-bg);
  }

.other-section{
    font-size: 30pt;
    text-align:center;
    color: #EDF5E1;
    margin-bottom: 10px;
 }
.contact-links{
      text-align: center; 
    }
    .profile-link{
      display: inline-block;/*just add this*/
    }
    .profile-link img{
      width: 50px;

    }
代码语言:javascript
复制
<section id="Contact">
  <h1 class="other-section">Contact</h1>
  <div class="contact-links">
    <a class="profile-link" href="https://facebook.com/" target="_blank">
     <img src="https://image.flaticon.com/icons/svg/21/21155.svg" />
    </a>
    <a class="profile-link" href="https://github.com/jadenadams329" target="_blank">
       <img src="https://image.flaticon.com/icons/svg/25/25231.svg" />
     </a>
    <a class="profile-link" href="https://instagram.com" target="_blank">
       <img src="https://image.flaticon.com/icons/svg/87/87390.svg" /> 
    </a>
  </div>
</section> 

票数 1
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/58194097

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档