Edit online

If you need to style a fragment of text (for example, a company slogan) with certain colors or font styles, you have several options:
  • Use an SVG image as background for a page margin box or for the entire page. See: How to Add a Background Image to the Header.
  • Use the oxy_label constructor. This is a function that creates a text label with a set of styles.
    @page {
        @top-right {
            content: oxy_label(text, "My Company", styles, "color:red; font-size: larger;") 
                     ' ' 
                     oxy_label(text, "Product", styles, "color:blue; text-decoration:underline;"));
        }
    }
    You can combine the oxy_label with oxy_xpath, to extract and style a piece of text from the document:
    content: oxy_label(text, oxy_xpath("/some/xpath"), styles, "color:blue; "));
    Note: These functions work only with the Chemistry CSS processor.
    Note: You cannot use string() inside an oxy_label(). As a workaround, to apply styling on the dynamic text retrieved by a string() function you can define some overall styles for the entire page margin box and then use the oxy_label to style differently the static text.
    @page {
        @top-right {
    	 color: red;
            content: oxy_label(text, "My Company", styles, "color:black") 
                     ' ' 
                     string(chaptertitle); /* This inherits the styling from @top-right*/
        }
    }
  • Use two adjacent page margin boxes, and style them differently:
    @page {
      @top-center {
        content: "First part";
        color: red;
        text-align:right;
      }
      @top-left {
        content: "- Second part";
        color: blue;
        text-align:left;
      }
    }