html-customization-css.dita 3.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970
  1. <?xml version="1.0" encoding="UTF-8"?>
  2. <!DOCTYPE task PUBLIC "-//OASIS//DTD DITA Task//EN" "task.dtd">
  3. <!-- This file is part of the DITA Open Toolkit project. See the accompanying LICENSE file for applicable license. -->
  4. <task id="custom-html-css">
  5. <title>Adding custom CSS</title>
  6. <shortdesc>To modify the appearance of the default HTML output that DITA Open Toolkit generates, you can reference a
  7. custom Cascading Style Sheet (CSS) file with the typography, colors, and other presentation aspects that define your
  8. corporate identity.</shortdesc>
  9. <prolog>
  10. <metadata>
  11. <keywords>
  12. <indexterm>cascading style sheet<index-see>CSS</index-see></indexterm>
  13. <indexterm>CSS<indexterm>adding custom</indexterm></indexterm>
  14. <indexterm>HTML<indexterm>CSS</indexterm></indexterm>
  15. <indexterm>HTML5<indexterm>CSS</indexterm></indexterm>
  16. <indexterm>transformations<indexterm>HTML5</indexterm></indexterm>
  17. </keywords>
  18. </metadata>
  19. </prolog>
  20. <taskbody>
  21. <context>
  22. <p>You can use this approach when you need to adjust the look and feel of the default output for a single project,
  23. but don’t want to create a custom DITA-OT plug-in.</p>
  24. <p>You can version the CSS file along with the DITA source files in your project, so stylesheet changes can be
  25. tracked along with modifications to topic content.</p>
  26. <p>You may also find this approach useful as you develop a custom stylesheet. Once the CSS rules stabilize, you
  27. can bundle the CSS file in a custom DITA-OT plug-in to ensure consistent HTML output across
  28. projects.</p></context>
  29. <steps>
  30. <step>
  31. <cmd>Create a custom CSS file and store it in your project along with your DITA source files.</cmd>
  32. <stepxmp>
  33. <note>As a starting point, you can use the CSS file that is used for the DITA-OT documentation. This file is
  34. available in the installation folder under <filepath>docsrc/resources/dita-ot-doc.css</filepath>.</note>
  35. </stepxmp>
  36. </step>
  37. <step>
  38. <cmd>Set the <parmname>args.css</parmname> parameter to the name of your custom CSS file.</cmd>
  39. <info>
  40. <p>The value of this parameter should be only the file name. The relative path to the file can be specified
  41. with <parmname>args.cssroot</parmname>.</p></info>
  42. </step>
  43. <step>
  44. <cmd>Set the <parmname>args.copycss</parmname> parameter to <option>yes</option>.</cmd>
  45. <info>
  46. <p>This setting ensures that your custom CSS file will be copied to the output directory.</p></info>
  47. </step>
  48. <step>
  49. <cmd>Set <parmname>args.cssroot</parmname> to the folder path that contains your custom CSS file.</cmd>
  50. <info>
  51. <p>The value you enter here will be interpreted relative to the location of the input map file. If your map is
  52. stored at the root level of your project folder and the CSS file is stored in a subfolder named
  53. <filepath>resources</filepath>, set <parmname>args.cssroot</parmname> to
  54. <option>resources</option>.</p></info>
  55. </step>
  56. <step importance="optional">
  57. <cmd>Set <parmname>args.csspath</parmname> to specify the location of the CSS file in the output folder.</cmd>
  58. <info>
  59. <p>If <parmname>args.csspath</parmname> is not set, the custom CSS file will be copied to the root level of
  60. the output folder. To copy the CSS file to a subfolder named <filepath>css</filepath>, set
  61. <parmname>args.csspath</parmname> to <option>css</option>.</p></info>
  62. </step>
  63. </steps>
  64. <result>
  65. <note type="tip">For an example of HTML output generated using this method, see the HTML5 version of the DITA-OT
  66. documentation included in the installation folder under <filepath>doc/index.html</filepath>.</note>
  67. </result>
  68. </taskbody>
  69. </task>