HTML/XHTML Standard Rules

Discussion in 'HTML & Website Design' started by trevor-, Jan 16, 2010.

  1. #1
    Hey everyone, would any of you happen to know where I can find the basic rules for XHTML? I have one in particular (that, if could be solved here too would be very helpful) concerning text.

    Text must always, always be placed either within a paragraph tag, a span tag (even if the span is empty aka no attributes?), an li, or a heading (h1, h2). Do links have to be between paragraphs? Is what I just stated there not true, or must I wrap everything with - for example - the paragraph tag?

    And where would I find this, say on the w3c webpage, and other in-text standards (i.e. [br /] and such for ... I forget what they're called, sorry, but elements or attributes that don't have a start and an end)?

    Thank you!
     
    trevor-, Jan 16, 2010 IP
  2. kjmoney

    kjmoney Peon

    Messages:
    27
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #2
    I remember the good ole days of learning HTML. Go to w3.org

    It is VERY helpful! That is how I got through my high school class.

    And links can be within <p></p>

    For example, <p><a href="http://link.com">Link</a></p>

    is valid. post more if u have any more questions
     
    kjmoney, Jan 17, 2010 IP
  3. swashata

    swashata Member

    Messages:
    86
    Likes Received:
    2
    Best Answers:
    0
    Trophy Points:
    43
    #3
    Hi! For learning HTML you can go here => http://www.w3schools.com/html/default.asp

    For XHTML visit this => http://www.w3schools.com/xhtml/default.asp

    The self closable tags are
    <br /> <img /> <input /> <link /> <hr />
    HTML:
    etc

    The basic rules for XHTML is that it is strict like XML. Means all the tags must be properly closed. You can not close one tag before another... For example

    <p>This is a <a href="#">LINK</p></a>
    HTML:
    is wrong... Following is right:

    <p>This is a <a href="#">LINK</a></p>
    HTML:
    And yaa, for valid XHTML, < a > needs to be inside < p > tag!
     
    swashata, Jan 17, 2010 IP
  4. jamesicus

    jamesicus Peon

    Messages:
    477
    Likes Received:
    18
    Best Answers:
    0
    Trophy Points:
    0
  5. trevor-

    trevor- Peon

    Messages:
    10
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #5
    None of these answered my question (edit: actually swashata did confirm that links must be within a paragraph tag, but of course I am asking if you can use other tags/if there is an official list). To clarify what I am asking:

    MUST text ALWAYS be inbetween a paragraph tag of some sort? According to the standard, is it not WRONG to say,
    [div]text text text[/div]
    without enclosing the text inside a paragraph, or inside a span?

    I know that it is wrong, so that question is already answered. So then, what must text be enclosed with? I was wondering if there was an official list somewhere.
     
    Last edited: Jan 17, 2010
    trevor-, Jan 17, 2010 IP
  6. trevor-

    trevor- Peon

    Messages:
    10
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #6
    Nope... couldn't find the answer in any of those links.

    Anyone?
     
    trevor-, Jan 17, 2010 IP
  7. jamesicus

    jamesicus Peon

    Messages:
    477
    Likes Received:
    18
    Best Answers:
    0
    Trophy Points:
    0
    #7
    jamesicus, Jan 17, 2010 IP
  8. kjmoney

    kjmoney Peon

    Messages:
    27
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #8
    <div></div> is supposed to be inside of a paragraph tag, it just specifies a certain style. so yes, they do have to be in < p > < / p >
     
    kjmoney, Jan 17, 2010 IP
  9. trevor-

    trevor- Peon

    Messages:
    10
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #9
    while greatly appreciated, these are also not of help :( They mention everything except text as far as I can tell.

    For the latest reply: I don't think every div needs to be inside a paragraph...

    Anyway, I guess all text must be in a paragraph, even if it is a link (a)? Does an image in a div have to be inside a paragraph? Does this never annoy anyone - i.e. does everyone set their paragraphs to be inline?...

    Why does no one really seem to get what I mean? I thought there was a standard for this...
     
    trevor-, Jan 17, 2010 IP
  10. kjmoney

    kjmoney Peon

    Messages:
    27
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #10
    just try it both ways and see if it is valid using the w3 validator
     
    kjmoney, Jan 17, 2010 IP
  11. swashata

    swashata Member

    Messages:
    86
    Likes Received:
    2
    Best Answers:
    0
    Trophy Points:
    43
    #11
    Now how come a div tag be inside a p tag! div [division] are box models, which may contain texts wrapped inside p tags.
     
    swashata, May 13, 2010 IP