views:

34

answers:

2

Sounds like that is possible, per W3C am able to validate the following HTML code:

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd"&gt;
<html>
<head>
   <title>Inline can another inline?</title>
</head>
<body>
   <div>
      <span>some text <span>comes here</span>.</span>
    </div>
</body>
</html>

Is that means an inline can contain another inline? Am confused, so long I thought only block-level elements can contain another block-level or inline elements. Also thought inline elements can contain only text. Can any one give some theory here with W3C reference or some reference, please? Thanks.

+3  A: 
BalusC
+1  A: 

Yes, some inline elements are allowed to contain inline elements. Here’s the definition of the parameter entity inline:

<!ENTITY % inline "#PCDATA | %fontstyle; | %phrase; | %special; | %formctrl;">

The content model for the elements described by the parameter entities fontstyle and phrase are then defined as follows:

<!ELEMENT (%fontstyle;|%phrase;) - - (%inline;)*>

That means all elements described by fontstyle and phrase can contain inline elements.

The other inline elements that are described by special and formctrl except the empty elements BR, IMG, INPUT, and except the elements SCRIPT, SELECT, and TEXTAREA (i.e. A, OBJECT, MAP, Q, SUB, SUP, SPAN, BDO, LABEL, and BUTTON) may contain inline elements (with some additional restrictions for LABEL, and BUTTON).

Gumbo