Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

how to put text on the middle of an image

Tags:

text

css

image

Hi Using CSS I'm trying to center some text on an image so it looks like this.

<div>
-------
|P    |
|  I  | This is some text.
|    C|
-------
</div>

How can I achieve that result? Don't know if that helps, the image is 32x32 pixels.

like image 337
afarazit Avatar asked Jan 02 '11 22:01

afarazit


1 Answers

img { vertical-align: middle; }

(although you'll probably want a more specific selector) and

<div>
<img alt="…" src="…" height="32" width="32"> This is some text.
</div>
like image 74
Quentin Avatar answered Oct 11 '22 11:10

Quentin