Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

inline elements 1

Status
Not open for further replies.

jimmyshoes

Programmer
Jun 1, 2008
132
GB
I understand that inline elements are laid out in lines and so vertical placement does not apply

If this is the case, then why is it that <img> can be padded 'all round' whereas <span> can only be padded left and right

Code:
<div style="border:1px solid #000000">
<img src="1.jpg" style="padding:29px"/>
</div>

<div style="border:1px solid #000000">
<span style="padding:29px">Text</span>
</div>
 
Images, along with some other elements such as form inputs) are not normal elements - they are what is known as "replaced elements" (see
Replaced elements often have different formatting abilities to regular inline elements, as you've found.

Hope this helps,
Dan



Coedit Limited - Delivering standards compliant, accessible web solutions

Dan's Page [blue]@[/blue] Code Couch:
Code Couch Tech Snippets & Info:
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top