HTML & CSS
Just curious...What's the difference between <span> and <p>? They do appear to have similar functions, but I know they don't.
<p> is a block level tag for paragraphs. <span> is a line level tag that in and of itself doesn't do anything, but is useful for defining a specific style to a string. <span> can be used within <p>, but <p> cannot be used within <span>
Usually people ask about <div> or <span>! You use span to style an inline element, like KLB said--for example, on a site I did, all my links were a certain style, but for one link, I needed it different so I wrote:
<a href="link"><span style="color: #xxxxx; text-decoration: none;">link here</span></a>
thus overriding my rule just this once with span. Span allows you to style little bits, doesn't create a line break like div. This is a pretty good illustration of <div> vs <span>
This topic is now closed. New replies are no longer allowed.