簡體   English   中英

將文本和圖像向右跨度,但它們都向左對齊

[英]span text and image to the right but both of them aligns to the left

這是我正在嘗試做的事情:

在此處輸入圖像描述

只是一個簡單的對齊方式,但是如果我將圖像向右浮動,如果我先放置文本,它就會轉到另一邊

https://jsfiddle.net/3gc0qjzo/

<span>
      <img src="img"/>
      <p>Learn More<p>
</span>

span img {
  float: right;
}
span p {
  display: block;
}

如果我先放圖片,再放文字,然后做一個float:left; 它可以找到,但我不確定如果圖像最后顯示如何對齊它們。

你可以使用彈性

   span{
     display:flex;
     flex-direction:row;
     align-items:center; 
   }

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM