简体   繁体   English

在<a>标签/路由器链接</a>内垂直居中字体真棒图标和文本

[英]Vertically center font awesome icon and text inside an <a> tag/router-link

I have a b-button which is basically a router-link/a tag which contents i'd like to center.我有一个 b 按钮,它基本上是一个路由器链接/一个标签,我想将其内容居中。 I want the text to be underneath my font awesome icon and both of them should be horizontally and vertically centered but nothing seems to work.我希望文本位于我的字体真棒图标下方,并且它们都应该水平和垂直居中,但似乎没有任何效果。

     <b-button variant="primary" class="main-navigation-button primary-custom-color"
                          :to="{name: 'companyCarList'}">
          <i class="fas fa-car fa-4x icon-full-width"></i> 
          Text
     </b-button>

Style of my button:我的按钮样式:

 .main-navigation-button {
        border: solid 1px transparent;
        border-radius: 1rem;
        box-shadow: 3px 3px 5px #ccc;
        font-size: 2vmax;
        margin-bottom: 20px;
        width: 15vw;
        height: 15vw;
        min-width: 150px;
        min-height: 150px;
    }

Try that:)试试看:)

.main-navigation-button primary-custom-color {
display:flex;
flex-direction:column;
justify-content: center;
align-items:center
}

small example -> https://codepen.io/AdamKniec/pen/jObzLRm小例子-> https://codepen.io/AdamKniec/pen/jObzLRm

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM