I recently worked on a web presentation with a complex Scalar Vector Graphics (SVG) diagram for a simple computer processor implementation. I wanted to discuss several different activities in the processor with multiple versions of the diagram emphasizing the parts of the diagram that are involved in the different activities.

There are many ways of doing this, but most that I have seen involved cutting and pasting the SVG diagram and/or its associated CSS style sheet into an HTML file. This creates a maintenance nightmare. So ideally I wanted to be able to put references to one SVG file and one CSS file into several HTML web pages, with minimal styling modifications added into the HTML files to modify the emphasized parts of the diagram. Then the HTML files can be pulled into the presentation with <object> tags.

To keep things simple, we work with the simple diagram shown below. We want HTML files, part-a.html, part-b.html, and part-c.html, that show each of the boxes along with the arrows connecting them to other boxes. For completeness we create HTML files nothing.html, where nothing is unfaded, and all.html, where all boxes and arrows are unfaded.

All of the HTML files use the following <link> tag in the document's <head> tag to bring in the style sheet selective-unfading.css.

<link rel="stylesheet" href="selective-unfading.css">

Its style rules fade the boxes and arrows with the following rule.

opacity: 0.2;

This makes the boxes and arrows semitransparent, which in effect fades them by letting the white background show through.

The HTML files also have an <svg> tag that contains the following tag.

<use xlink:href="selective-unfading.svg#diagram"/>

This brings in the diagram. So all of the HTML files share the same CSS and SVG files.

The only visual differences between the HTML files are

The shared files are discussed further in the "Shared Files" menu item to the left. The HTML files are discussed further in the "Various Unfadings" menu item to the left.

All of the diagram HTML files share the following files.

In the web page below (nothing.html) there is no <style> tag in the <svg> tag so nothing is unfaded.

<object style="width: 100%; height: 434px;" data="nothing.html"></object>

nothing.html

In this web page (all.html) the class "all" is declared to have opacity 1.0. This is done in a <style> tag inside the <svg> tag.

All of the boxes and all of the arrows have "all" in their style class.

<object style="width: 100%; height: 434px;" data="all.html"></object>

all.html

In this web page (part-a.html) the class "part-a" is declared to have opacity 1.0. This is done in a <style> tag inside the <svg> tag.

The box A and the arrow from box A to Box B have "part-a" in their style class.

<object style="width: 100%; height: 434px;" data="part-a.html"></object>

part-a.html

In this web page (part-b.html) the class "part-b" is declared to have opacity 1.0. This is done in a <style> tag inside the <svg> tag.

The box B and the arrows from box A to box B and from box B to Box C have "part-b" in their style class.

<object style="width: 100%; height: 434px;" data="part-b.html"></object>

part-b.html

In this web page (part-c.html) the class "part-c" is declared to have opacity 1.0. This is done in a <style> tag inside the <svg> tag.

The box C and the arrow from box B to Box C have "part-c" in their style classes.

<object style="width: 100%; height: 434px;" data="part-c.html"></object>

part-c.html

This example is an HTML file with an arrow entirely contained in its <svg> tag. If you print it (or just preview the print) it shows a complete arrow. An error occurs if the arrow is imported from an SVG file.

arrowhead-test-1.html

This example is an HTML file with an arrow imported from an SVG file. If you print it (or just preview the print) the arrowhead is lost.

arrowhead-test-2.html

arrowhead-test.svg