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.
<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?
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.
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.
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.
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.
Try this.
<span style="padding-right:3px; padding-top: 3px; display:inline-block;">
<img class="manImg" src="images/ico_mandatory.gif"></img>
</span>
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