Hello,
We recommend you to check the examples available on https://www.phpdocx.com/documentation/introduction/html-to-word-PHP. You can apply CSS styles using style tags:
<head>
<style>
p {font-style: italic;}
p.header {font-size: 20px; font-weight: bold;}
div.footer {font-size: 10px;}
</style>
</head>
external CSS files:
<head>
<link href="styles.css" type="text/css" rel="stylesheet" />
</head>
and inline styles:
<tr>
<td style="background-color: #ffff00">Cell 1 1</td>
<td>Cell 1 2</td>
</tr>
CSS styles must be applied each time embedHTML or replaceVariableByHTML are called.
UPDATE: HTML Extended (https://www.phpdocx.com/documentation/introduction/html-extended-to-word-PHP) , available in Premium licenses, includes addBaseCSS to set a base CSS used for all HTML conversions in the same script.
Regards.