DITA Resource Center

<div>

The <div> element is used to organize subsets of content into logical groups that are not intended to be or should not be contained as a topic.

The <div> element is designed to be a grouping element; it does not imply any explicit semantics or contain an explicit title. This avoids enabling the creation of deeply-nested content that would otherwise be written as separate topics. If the content requires a title, use a <section> element, a nested <topic>, or possibly a <fig> element.

Content models

See appendix for information about this element in OASIS document type shells.

Inheritance

- topic/div

Example

Using <div> for grouping

In the following example, a <div> element is used to organize several elements together so that they can be referenced by @conref or @conkeyref:

...
<div id="div-01">
 <p>The first paragraph</p>
 <p>The second paragraph</p>
 <note>This is a note</note>
</div>
...

Without using a <div> element, the content could not be grouped for content referencing since the start and end elements are of different types.

Using <div> for specialization

In the following example, <div> is used as the basis for specializing a new domain element, <pullquote>:

<!ENTITY % pullquote.content
  "(%div.cnt;)*"
>
<!ENTITY % pullquote.attributes
             "%univ-atts;
              outputclass 
                        CDATA 
                                  #IMPLIED"
>
<!ELEMENT pullquote    %pullquote.content;>
<!ATTLIST pullquote    %pullquote.attributes;>

<!ATTLIST pullquote      %global-atts;  class CDATA "+ topic/div pubcontent-d/pullquote ">

Instances of <pullquote> could then be used in both <body> and <section> contexts:

<topic id="article-01">
  <title>My Article</title>
  <body>
    <p>Something pithy someone said</p>
    <pullquote><p>Something Pithy</p></pullquote>
    <!-- ... -->
    <section spectitle="Deep Dive">
      <p>This is really really pithy</p>
      <pullquote><p>Really Pithy</p></pullquote>
      <!-- ... -->
    </section>
  </body>
</topic>

Attributes

The following attributes are available on this element: Universal attribute group and @outputclass.

Was this page helpful?