将图像与文本 CSS 对齐

发布于 2025-01-06 01:34:51 字数 308 浏览 1 评论 0原文

我不明白为什么这个文本不会与图像的中间对齐。检查下面的屏幕截图,一张突出显示,一张未突出显示:

image highlight

我希望“澳大利亚”一词排列在图像中间(与箭头对齐)。正如您从高光中看到的那样,问题不是图像的高度。

我尝试过vertical-align:middle,这有帮助,但正如你所看到的,它并不完美!

建议表示赞赏!

I can't understand why this text won't line up with the middle of an image. Check the screenshots below, one highlighted, one not:

image
highlight

I want the word Australia to line up in the middle of the image (aligned with the arrow). As you see from the highlight it isn't the height of the image that is the problem.

I have tried vertical-align:middle which helps but as you can see it is not perfect!

Suggestions appreciated!

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

吹泡泡o 2025-01-13 01:34:51

如果这是一个链接,请使用 CSS 背景。我猜测下面的值,但您可以根据您的情况轻松调整它们。

A.aus {
     background-image:url(../images/aus.png);
     background-position:0px 1px;
     display:block;
     height:40px;
     padding-left:60px;
     margin-top:3px;
     font-size:    ....etc.... 
}

If this is a link, use a CSS background. I'm guessing at the values below, but you can easily tweak them for your situation.

A.aus {
     background-image:url(../images/aus.png);
     background-position:0px 1px;
     display:block;
     height:40px;
     padding-left:60px;
     margin-top:3px;
     font-size:    ....etc.... 
}
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文