【问题标题】:Image not Vertically Aligned in CSS | HTML & CSS图像在 CSS 中未垂直对齐 | HTML 和 CSS
【发布时间】:2021-03-23 22:34:08
【问题描述】:

Image of the Website Footer

body {
    background-color: #222;
}

.minimal-footer {
    margin-left: 15%;
    color: #add8e6;
    font-family: 'Roboto Mono', monospace;
    list-style: none;
    font-size: 11px;
}

.text-wrapper {
    list-style: none;
    margin-top: 4%;
    margin-bottom: 4%;
    font-size: 12px
}


.text-wrapper li a {
    text-decoration: none;
    color: #add8e6;
}

.text-wrapper li a:hover {
    color: #fff;
    font-weight: bold; 
}
  <footer>
            <div class="minimal-footer">
                <ul class="text-wrapper">
                    <li><img src="img/creator.png" style="height: 16px;"><span class="footer-text"> Created by Obito</span></li>
                    <li><img src="img/creator.png" style="height: 16px;"><span class="footer-text"> Follow our <a href="twitter.com/ObitoFN">Twitter</a></span></li>
                    <li><img src="img/creator.png" style="height: 16px;"><span class="footer-text"> Check our other <a href="">Socials</a></span></li>
                    <li><img src="img/creator.png" style="height: 16px;"><span class="footer-text"> Support this <a href="">Project</a></span></li>
                </ul>
            </div>
        </footer>

我已经尝试在上面附加的代码中垂直对齐文本和图像,但我找不到解决方案。文本的顶部或底部总是有填充,不允许它以图像居中,我想删除它。

【问题讨论】:

    标签: javascript html css styling text-styling


    【解决方案1】:

    这应该可以解决问题:

    .text-wrapper li {
        display: flex;
        align-items: center;
    }
    

    【讨论】:

    • 谢谢,它工作了,但现在我添加的超链接粘在左边的文本上,中间没有空格
    • 你能再显示一张图片吗?在我的测试用例中,它看起来几乎像这样:[img] Follow our Twitter
    猜你喜欢
    • 2014-11-30
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2015-09-06
    • 2011-10-03
    • 1970-01-01
    相关资源
    最近更新 更多