2012-03-12 110 views
1

我有一個圖像,我想重新調整大小以適合除此之外的文本大小。文本應該按照這個文本左邊的圖像居中。如何重新調整大小以適合文本的圖像?

那麼該怎麼做?

(對不起,因爲我是新用戶,我不能發表圖片我不能上傳圖片)

編輯:

請看到我是什麼樣的例子談到HERE

+0

您可以張貼在jsfiddle.net的東西嗎? – Filype 2012-03-12 08:30:11

+0

請參閱我編輯的問題。 – 2012-03-12 09:29:14

回答

0

您應該在css中使用display:table-cell。那麼你應該定義文字的垂直對齊爲中間。

http://jsfiddle.net/cY22B/4/

+0

謝謝。我非常感謝你的幫助。 – 2012-03-12 09:59:15

0

使用動態編程語言,你可以生成代碼:

<div class="image"> 
<img width="350" src="http://placehold.it/350x150" alt="A national flag" /> 
</div> 
<div class="text" style="width:350px;"> 
This is the national flag and this is why we are using it. 
</div> 
<br class="clear" /> 

查看工作示例:http://jsfiddle.net/cY22B/

+0

感謝您的幫助,但請您查看我編輯的問題? – 2012-03-12 09:29:46

+0

非常感謝,但如果您發現我的答案有幫助,請考慮投票。 – Filype 2012-03-12 10:04:25

相關問題