我使用以下HTML代码创建了一个由图像和文本组成的span元素。我想使用下面的css类使文本与图像对齐:
```html
然而,这并没有像预期的那样起作用。文本仍然与图像左对齐。那么我的代码有什么问题?如何将文本居中对齐?
提前感谢。
```html
我已经制作了一个由图像和文字组成的span元素,使用以下HTML代码。我正在尝试使用以下css类将文本与图像对齐:
```span.my-profile {
background-image: url('http://placehold.it/450x100/fc6');
background-position: left center;
background-repeat: no-repeat;
padding-left: 16px; /* Or size of icon + spacing */
text-align: center;
}
<span class="my-profile">My Full Name</span>
提前感谢。