SitePoint Sponsor

User Tag List

Results 1 to 4 of 4
  1. #1
    SitePoint Wizard jax502's Avatar
    Join Date
    Jul 2003
    Location
    Jacksonville, FL
    Posts
    1,031
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Question Difference between <span> & <p>

    Just curious...What's the difference between <span> and <p>? They do appear to have similar functions, but I know they don't.
    jax502

  2. #2
    SitePoint Wizard silver trophy KLB's Avatar
    Join Date
    Nov 2003
    Location
    Maine USA
    Posts
    3,781
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    <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>
    Ken Barbalace: EnvironmentalChemistry.com (Blog, Careers)
    InternetSAR.org
    Volunteers Assist Search and Rescue via Internet
    My Firefox Theme: Classic Compact
    Based onFirefox's default theme but uses much less window space

  3. #3
    Pointiest Petitions carrotflowers's Avatar
    Join Date
    Jul 2003
    Location
    Suburbs of DC (MD)
    Posts
    595
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    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>
    http://www.goer.org/HTML/intermediate/div_and_span/

  4. #4
    SitePoint Wizard jax502's Avatar
    Join Date
    Jul 2003
    Location
    Jacksonville, FL
    Posts
    1,031
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Thanks a million!
    jax502


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •