SitePoint Sponsor

User Tag List

Results 1 to 5 of 5
  1. #1
    SitePoint Evangelist fs_tigre's Avatar
    Join Date
    Feb 2009
    Location
    Close to Chicago, Illinois
    Posts
    517
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Can the "p" tag hold other than just text elements

    Hi,

    The more I read about HTML and CSS the more I know how much I dont know. I was trying to incorporate a search box in one of my sites and I was searching on the internet to see what was the most appropriate way to create this and to my surprise I came across a tutorial that actually show the input field surrounded with a "p" tag. Something like this...

    Code:
    <form action=" method="get">
     <p>Search:<input type="submit"></p>
    </form>
    Can the P tag hold other than just text elements? If yes, when would you do this and why?

    Thanks a lot!
    Thank you very much!!!

  2. #2
    Robert Wellock silver trophybronze trophy xhtmlcoder's Avatar
    Join Date
    Apr 2002
    Location
    A Maze of Twisty Little Passages
    Posts
    6,316
    Mentioned
    60 Post(s)
    Tagged
    0 Thread(s)
    Yes, the P element can contain other elements as it is block-level, for example P can contain the inline SPAN. Albeit I think you were actually asking why is there a P as a direct descendant of the FORM in that example?

    Well, I'd say probably because they (see example post #1) aren't bothered about semantics. It's not a very good use of semantics I suspect they didn't even use LABEL in the full form, etc.

  3. #3
    Sploghm bronze trophy Victorinox's Avatar
    Join Date
    Nov 2008
    Posts
    749
    Mentioned
    4 Post(s)
    Tagged
    0 Thread(s)
    The main restriction is that paragraphs should not contain block-level elements.

    See the HTML 4.01 spec


  4. #4
    SitePoint Evangelist fs_tigre's Avatar
    Join Date
    Feb 2009
    Location
    Close to Chicago, Illinois
    Posts
    517
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Thanks a lot guys!
    Thank you very much!!!

  5. #5
    Robert Wellock silver trophybronze trophy xhtmlcoder's Avatar
    Join Date
    Apr 2002
    Location
    A Maze of Twisty Little Passages
    Posts
    6,316
    Mentioned
    60 Post(s)
    Tagged
    0 Thread(s)
    No problem dude.


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
  •