#### 31.6.3 Customizing the CSS link tag

The generic CSS link tag DITA2Go inserts in your HTML output looks like this:

<link rel="stylesheet" href="MyStyles.css" type="text/css">

Suppose you want to specify additional properties for the CSS file, such as media type. First, you must prevent DITA2Go from writing the generic link tag:

[CSS]
WriteCssLink=No

To specify the link yourself, assign it to the <head> element:

[Inserts]
; You must type the following all on one line:
Head=<link rel="stylesheet" href="MyStyles.css" type="text/css" media="screen">

As an alternative, you could reference the link as a macro (see §37.1 Defining and invoking macros):

[Inserts]
Head=<$MyCSSLink>

[MyCSSLink]
<link rel="stylesheet" href="MyStyles.css" type="text/css" media="screen">

You could even go a step further, and provide a macro variable (see §37.3 Using macro variables) for the value of the attribute, so you can change the value in just one place:

[MyCSSLink]
<link rel="stylesheet" href="MyStyles.css" type="text/css" media="<$$MediaType>">

[MacroVariables]
MediaType=screen

Previous Topic: 31.6.2 Changing CSS files in the middle of a document

Next Topic: 31.6.4 Using an alternate CSS link tag for Netscape 4

Parent Topic: 31.6 Linking to alternate CSS files

Sibling Topics:

31.6.1 Selecting a CSS file at run time

31.6.2 Changing CSS files in the middle of a document

31.6.4 Using an alternate CSS link tag for Netscape 4

Table of Contents • Index