DITA and XMetaL Discussion

XMetaL Community Forum DITA and XMetaL Discussion Customize Tag on View by using CSS

  • olli_lib

    Customize Tag on View by using CSS

    Participants 0
    Replies 1
    Last Activity 5 years, 10 months ago

    I have downloaded the XMetal Author 12 Version and want to customize the style of the Tag on View by using css.
    I use the topic.dtd in my xml file.
    My Question:
    In which css file can I make this change e.g. change font color of the tag to red?

    Thank for Help


    Derek Read

    Reply to: Customize Tag on View by using CSS

    You can extend the CSS files used for DITA authoring, and specifically the topic.dtd, by adding selectors to this file:

    C:Program FilesXMetaL 12.0AuthorDITAXACstopictopic_ditabase-specialized.css

    The is the folder used by the version of DITA you are authoring to, as set in Tools > DITA Options on the General tab under “Select Default DITA Version”. In version 12 you can choose from 1.1, 1.2 or 1.3. The default version is 1.3.

    Keep in mind that standard W3C CSS cascading rules apply. So, if you are overriding a previously defined CSS selector (which is very likely) any selector you add needs to be at least as “specific”. Any property set on the other selector will also still be in effect unless you provide a new value for it. Also, all the selectors for DITA use the DITA @class for the element (not the element name). This allows them to automatically be applied to any elements in any specialized DITA DTD that specializes that element (ie: if you specialize to add a element based on

    then they will look the same). In order to be as specific (according to the CSS cascade rules) you need to follow the same format (which basically means using the class attribute).

    To check which other values are previously set have a look at this file (and the files it imports):

    C:Program Files (x86)XMetaL 12.0AuthorDITAXACstopictopic_ditabase.css
    C:Program FilesXMetaL 12.0AuthorDITAXACstopictopic_ditabase.css

    That file just imports other CSS files, like so:

    @import url(....sharedditabase-base.css);
    @import url(..ditabaseditabase-base-override.css);
    @import url(....sharedditabase-derived.css);
    @import url(..ditabaseditabase-derived-override.css);
    @import url(topic_ditabase-specialized.css);

    …which is why you would normally add any of your own overrides or additional selectors to topic_ditabase-specialized.css

    Of course you could also make modifications directly to any of these CSS files, it is just a bit cleaner to do it this way because then all of your changes are in one place. Adding them to topic_ditabase-specialized.css also means they are guaranteed to load last.

    I would recommend commenting any changes you make with the date and reason. XMetaL Support often has clients contacting them for help with changes made to the software several years after they were done (not usually CSS, but macros and other functionality) when the creator is either now gone or doesn't know what they did or why. Makes it impossible to guess what the intended purpose for any particular change might have been.

    Example that turns topic/p elements red for the topic.dtd for DITA version 1.3:

    The CSS selector for this element is defined here (and imported by the other DITA CSS files):

    C:Program FilesXMetaL 12.0AuthorDITAXACssharedditabase-base.css

    /* p */
    [class~="topic/p"] {
    display: block;
    margin-top: 2px;
    margin-right: 2px;
    margin-bottom: 8px;

    Modify this file:
    C:Program FilesXMetaL 12.0AuthorDITAXACs1.3topictopic_ditabase.css

    Add something similar to this:
    /* Derek Read
    changed p element to make it red
    because I needed it to stick out and be really obvious
    [class~="topic/p"] {
    color: red


  • You must be logged in to reply to this topic.

Lost Your Password?