Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to fit in an image inside span tag?

Tags:

html

css

image

I have an image inside a span tag. But the problem is the image doesn't fit inside the span tag. Instead a part of the image goes out of the span tag.

enter image description here

enter image description here

    <span style="padding-right:3px; padding-top: 3px;">

    <img class="manImg" src="images/ico_mandatory.gif"></img>

    </span>

I want to have that bar inside the span i.e It should be adjacent to the text box.

How can I achieve it?

like image 814
kumareloaded Avatar asked Dec 11 '14 15:12

kumareloaded


People also ask

Can you put an image inside a span?

Usually span element is used to group inline elements together to implement style (using id or class attributes) or language information or JavaScript DOM(using id or class attributes), when no other element is found suitable to form that group. 3. The element can contain a piece of text or an image directly.

Can I use a tag inside span?

So if you start with a <span> then an <a> , make sure you close the <a> tag first before closing the <span> and vice-versa. Save this answer. Show activity on this post. It doesn't matter - they're both allowed inside each other.

Can a form be inside a span?

Yes it's valid and you can use any number of divs, spans or blockquotes inside a form. You can always use W3C Markup Validation Service to check your html.

Can a span tag have a width?

The <span> tag is a inline element, it fits into the flow of the content and can be distributed over multiple lines. We can not specify a height or width or surround it with a margin.


1 Answers

Try this.

<span style="padding-right:3px; padding-top: 3px; display:inline-block;">

<img class="manImg" src="images/ico_mandatory.gif"></img>

</span>
like image 186
WebbySmart Avatar answered Sep 17 '22 13:09

WebbySmart