• Skip to primary navigation
  • Skip to main content
  • Skip to primary sidebar

Learning DITA

Free DITA training

Free DITA training

  • Log in
  • Register
  • Newsletter
  • Profile
  • Privacy
  • Home
  • About
  • Courses
  • News
  • Resources
  • Support the site
  • Contact
  • Recordings

Be consistent

Posted on 08.30.15

Because DITA content exists separately from formatting, consistent use of the DITA structure and tags is key to ensuring that all of your output types will look the way you expect.

One negative side effect of inconsistent tagging is mixed content. Suppose you have the following unordered list:

<ul>
<li>text</li>
<li>text</li>
<li>text
<p>text</p>
</li>
</ul>

In this example, the last list item contains two paragraphs. Because the <p> element is valid inside the <li> element, it is possible to tag each paragraph separately. However, tagging this content as shown in the example means that you now have mixed content—the last <li> element has one line of text tagged simply with the <li> element, and another line with <p> tags around it. This could affect the styling of the text of this list item in the final output.

To avoid having mixed content, surround all text inside an <li> element with <p> tags, whether you are tagging one paragraph or more:

<ul>
<li><p>text</p></li>
<li><p>text</p></li>
<li>
<p>text</p>
<p>text</p>
</li>
</ul>

In addition to the <li> element, we recommend that text inside the <note>, <entry>, and <stentry> elements be surrounded with <p> tags in case there are multiple paragraphs. To help ensure consistency and avoid mixed content, use the <p> tag for any text that does not need to be tagged in a specific way.

Contributors
  • Gretyl Kinsey, Scriptorium

sidebar

Blog Sidebar

  • Scriptorium logo
    Maximize the value of your content. Read more.
  • Scriptorium logo
    Already in DITA and need support? Contact us.
RSSTwitter

Want to add content? Join the ditatraining GitHub repository.

  • Home
  • Sponsor
  • News
  • Contact
  • Privacy

Maintained by Scriptorium Publishing

Logo and site presentation © 2015-2022 Scriptorium Publishing. Content based on the open-source DITA training project.