• 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

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

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
  • Cookie Policy

Maintained by Scriptorium Publishing

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

Manage Cookie Consent
To provide the best experiences, we use technologies like cookies to store and/or access device information. Consenting to these technologies will allow us to process data such as browsing behavior or unique IDs on this site. Not consenting or withdrawing consent, may adversely affect certain features and functions.
Functional Always active
The technical storage or access is strictly necessary for the legitimate purpose of enabling the use of a specific service explicitly requested by the subscriber or user, or for the sole purpose of carrying out the transmission of a communication over an electronic communications network.
Preferences
The technical storage or access is necessary for the legitimate purpose of storing preferences that are not requested by the subscriber or user.
Statistics
The technical storage or access that is used exclusively for statistical purposes. The technical storage or access that is used exclusively for anonymous statistical purposes. Without a subpoena, voluntary compliance on the part of your Internet Service Provider, or additional records from a third party, information stored or retrieved for this purpose alone cannot usually be used to identify you.
Marketing
The technical storage or access is required to create user profiles to send advertising, or to track the user on a website or across several websites for similar marketing purposes.
Manage options Manage services Manage vendors Read more about these purposes
View preferences
{title} {title} {title}
Manage Cookie Consent
To provide the best experiences, we use technologies like cookies to store and/or access device information. Consenting to these technologies will allow us to process data such as browsing behavior or unique IDs on this site. Not consenting or withdrawing consent may adversely affect certain features and functions.
Functional Always active
The technical storage or access is strictly necessary for the legitimate purpose of enabling the use of a specific service explicitly requested by the subscriber or user, or for the sole purpose of carrying out the transmission of a communication over an electronic communications network.
Preferences
The technical storage or access is necessary for the legitimate purpose of storing preferences that are not requested by the subscriber or user.
Statistics
The technical storage or access that is used exclusively for statistical purposes. The technical storage or access that is used exclusively for anonymous statistical purposes. Without a subpoena, voluntary compliance on the part of your Internet Service Provider, or additional records from a third party, information stored or retrieved for this purpose alone cannot usually be used to identify you.
Marketing
The technical storage or access is required to create user profiles to send advertising, or to track the user on a website or across several websites for similar marketing purposes.
Manage options Manage services Manage vendors Read more about these purposes
View preferences
{title} {title} {title}