• 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

Adding images to a concept topic

Posted on 08.30.15

Adding images to a concept topic
Lesson Progress
0% Complete

You add images to a concept topic using the <image> element. The <image> element uses the href attribute to create a link to the image’s location on the web or on a local server.

Much like a <p> element, you can use the <image> element anywhere in the <conbody> element. It is also fairly common to use images inline inside a <p> element.

If your image needs a title or caption, use the <fig> (or figure) element. The <fig> element can contain a <title> element and one or more <image> elements.

Video: Creating a figure with an image in DITA

Practice
  1. Make a copy of the file lesson2/l_concept_images_tables_start.dita and open it in your editor.
    You should see this:
    <?xml version="1.0" encoding="UTF-8"?>
    <!DOCTYPE concept PUBLIC "-//OASIS//DTD DITA Concept//EN" "concept.dtd">
    <concept id="concept_images_tables">
       <title>Duckling growth and development</title>
    <conbody>
       </conbody>
    </concept>
  2. Inside the <conbody> element, add an <image> element as shown in the following example, using the file lesson2/images/ducklings_sitting.jpg for the sample image:
    <?xml version="1.0" encoding="UTF-8"?>
    <!DOCTYPE concept PUBLIC "-//OASIS//DTD DITA Concept//EN" "concept.dtd">
    <concept id="concept_images_tables">
       <title>Duckling growth and development</title>
       <conbody>
    <image href="images/ducklings_sitting.jpg"/>
       </conbody>
    </concept>
    (Sample image source: Flickr, Micolo J)
    The <image> element you added contains a link (href) to the location of the image file. A link inside an <image> element can point to the filepath for an image on a server or to a web link for an image.
  3. After the <image> element, add a <fig> element as shown in the following example, the file lesson2/images/ducklings_running.jpg for the sample image:
    <?xml version="1.0" encoding="UTF-8"?>
    <!DOCTYPE concept PUBLIC "-//OASIS//DTD DITA Concept//EN" "concept.dtd">
    <concept id="concept_images_tables">
       <title>Duckling growth and development</title>
      <conbody>
    ...
    <fig>
    <title>Ducklings walking</title>
    <image href="images/ducklings_running.jpg"/>
    </fig>

       </conbody>
    </concept>
    (Sample image source: Flickr, Airwolfhound)
    The <fig> element is another way to add an image to a concept topic.
    The <fig> element you added contains a <title> element and an <image> element. The <title> element allows you to associate a caption with your image.
    The <image> element is structured the same way inside the <fig> element as it is inside the <conbody> element.
    The <fig> element can contain one or more <image> elements (but only one <title> element).

    Note:

    In a <fig> element, the <title> element always goes before the <image> element in DITA, but the caption could appear above or below the image (or elsewhere) in the final output.

Contributors
  • Gretyl Kinsey, Scriptorium
Back to

sidebar

Blog Sidebar

  • Scriptorium logo
    Maximize the value of your content. Read more.
  • Scriptorium logo
    Need DITA help? We offer flat-rate consulting. Get help.
  • 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-2021 Scriptorium Publishing. Content based on the open-source DITA training project.