I want to show text below image in these spans and spans do not jump to new line:
<span class="smileycode" id=":sm:">
<img src="images/smiley/sm.png">:sm:
</span>
<span class="smileycode" id=":sq:">
<img src="images/smiley/sq.png">:sq:
</span>
any suggestion?
Use a p or div rather than a span. Text is an inline element and so is a span. For text-align to work, it must be used on a block level element (p, div, etc.) to center the inline content.
CSS position property is used to set the position of text over an image. This can be done by enclosing the image and text in an HTML “div”. Then make the position of div “relative” and that of text “absolute”.
To center an inline element like a link or a span or an img, all you need is text-align: center . For multiple inline elements, the process is similar. It's possible by using text-align: center .
DEMO
.smileycode{
display:inline-block;
}
.smileycode img{
display:block;
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With