HTML Standard: <mark> tag

<mark> tag

Inserts a highlighted text.

This tag can be replaced by a CSS style.

By default, phpdocx applies a shading style to mark tags rather than a text highlight style. In MS Word, shading allows RGB colors, while highlight styles are limited to a predefined set of colors. phpdocx applies a highlight color as shading style to support RGB colors and avoid this MS Word limitation/requirement. If, instead of a shading color, a highlight color must be applied, the data-highlight option available in CSS Extended can be used.

Attributes
Attribute Description
class One or more classes.
id Id.
style Inline styles. Styles can also be applied using style tags.
Styles
Style Description
background-color
  • hexadecimal color
  • HSL color
  • HSLA color (alpha value is ignored)
  • predefined/cross-browser color
  • RGB color
  • RGBA color (calculated from RGB color)
color
  • initial
  • hexadecimal color
  • HSL color
  • HSLA color (alpha value is ignored)
  • predefined/cross-browser color
  • RGB color
  • RGBA color (calculated from RGB color)
direction
  • ltr
  • rtl
display
  • none
font-family
  • Arial, Helvetica, "Times New Roman", Verdana... Any font can be applied, but it must be available in the DOCX or in the OS.
font-size
  • initial
  • large
  • larger
  • length: cm, em, ex, in, mm, pt, pc, px, percentage, rem (as em)
  • medium
  • small
  • smaller
  • x-large
  • x-small
  • xx-large
  • xx-small
font-stretch
  • condensed
  • expanded
  • extra-condensed
  • extra-expanded
  • semi-condensed
  • semi-expanded
  • ultra-condensed
  • ultra-expanded
font-style
  • italic
  • normal
  • oblique
font-variant
  • small-caps
font-weight
  • bold
  • bolder
  • normal
  • 700, 800, 900
letter-spacing
  • length: cm, in, mm, pt, pc, px
  • normal
text-decoration
  • line-through
  • double-line-through
  • none
  • underline
text-decoration-color
  • hexadecimal color
text-decoration-style
  • dashed
  • dotted
  • double
  • solid
  • wavy
text-transform
  • uppercase
vertical-align
  • sub
  • super
Custom MS Word styles

Using createCharacterStyle and HTML, custom character styles can be applied to use more styles.

HTML Extended (Premium licenses)
Attribute Description
data-lang Set a custom language: language-region (en-US).
data-rpr Applies a custom rPr style.
CSS Extended (Premium licenses)
Style Description
data-color Sets to "initial" to avoid applying a color.
data-em Emphasis mark type:
  • none
  • dot
  • circle
  • comma
  • underDot
data-custom Custom rPr style.
data-font-family Sets to "initial" to avoid applying a font family.
data-font-size Sets to "initial" to avoid applying a font size.
data-highlight Highlight style: black, blue, cyan, green, magenta, red, yellow, white, darkBlue, darkCyan, darkGreen, darkMagenta, darkRed, darkYellow, darkGray, lightGray.
Code samples

Example #1

The resulting Word document looks like:

Example #2

The resulting Word document looks like: