Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

css - align text below image in a span

Tags:

html

css

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>&nbsp;
<span class="smileycode" id=":sq:">
    <img src="images/smiley/sq.png">:sq:
</span>&nbsp;

any suggestion?

like image 908
exim Avatar asked Sep 11 '13 13:09

exim


People also ask

Can you use text-align with SPAN?

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.

How do you put text under an image in CSS?

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”.

How do you align text in a span tag?

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 .


1 Answers

DEMO

enter image description here

.smileycode{
  display:inline-block;
}
.smileycode img{
  display:block;
}
like image 148
Roko C. Buljan Avatar answered Sep 22 '22 13:09

Roko C. Buljan