SitePoint Sponsor

User Tag List

Results 1 to 7 of 7

Hybrid View

  1. #1
    SitePoint Enthusiast
    Join Date
    Jul 2009
    Posts
    76
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Question Some Block level elements cannot contain Block elements

    Hi,

    I used to think that all block-level elements can contain block elements & inline elements.

    In reference.sitepoint.com/html/h1, reference.sitepoint.com/html/h6 , reference.sitepoint.com/html/p etc. it's mentioned:

    This element may contain any text content, but it can’t include any block-level elements: only inline or phrase elements can be included.
    When I checked, I saw that <h1>, <h2>....<h6>, <p>, <li> inside <dir> or <menu> cannot contain block-level elements.

    Are there any other block elements that cannot contain block elements?

  2. #2
    Mazel tov! bronze trophy kohoutek's Avatar
    Join Date
    Aug 2004
    Location
    Hamburg, Germany
    Posts
    4,248
    Mentioned
    30 Post(s)
    Tagged
    0 Thread(s)
    dt is another one I can think of.
    Maleika E. A. | Rockatee | Twitter | Dribbble



  3. #3
    SitePoint Enthusiast
    Join Date
    Jul 2009
    Posts
    76
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    ya...
    Code:
    <dl>
       <dt>
          <div>hi</div>
       </dt>
    </dl>
    is not validating

  4. #4
    SitePoint Enthusiast
    Join Date
    Jul 2009
    Posts
    76
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    reference.sitepoint.com/html/dt
    Note that it can’t contain any block-level elements—not even p or heading elements such as h1, h2, and so on. It can only contain text.
    Any other?

  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)
    The answer to the question partially depends upon whether you are using either: Strict or Transitional HTML 4.01 markup?

    Since it actually differs on what is allowed within a block-level element itself. ;-)

    Thus assuming Strict others may include: ADDRESS, FIELDSET, PRE there are other deprecated tag examples and some that obviously follow 'specific rules' e.g. like UL having a LI but I won't bother with those, etc. Maleika already covered definition lists and you spotted some others at that SP refrence too.

  6. #6
    SitePoint Enthusiast
    Join Date
    Jul 2009
    Posts
    76
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    thanks Robert

    I'm concerned about Strict mode.

    Where to find more details? Sitepoint's reference on ADDRESS, FIELDSET, PRE doesn't mention anything about this.
    Where do you get such info?

  7. #7
    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)
    From the horse's mouth: http://www.w3.org/TR/html401 rather than a book it's explained in the W3C TR http://www.w3.org/TR/html401/index/elements.html even though its not light reading.


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
  •