[英]When i align a div to the center of a page using css it goes from the left side of the image not the center
[英]CSS: How to align text to the center of the image (left side)
<p style="text-align:center;display:inline-block">yes </p>
<img width="50px" height="50px" src="">
如何使“是”的上半部分與圖像塊的中心位置對齊? 什么是良好做法?
------
| |
yes | |
|____|
使用vertical-align:middle;
。 這將使文本和圖像對齊所需的方式。
編碼
<p style="text-align:center;display:inline-block;">yes </p>
<img width="50px" height="50px" src="" style=" vertical-align:middle;">
希望這可以幫助。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.