CssToInlineStyles class
Possible Methods
__construct
Creates an instance, you could set the HTML and CSS here, or load it later.
Parameters
- html string (optional)
- The HTML to process
- css string (optional)
- The CSS to use
Return
void
convert
Converts the loaded HTML into an HTML-string with inline styles based on the loaded CSS
Return
string
Example
<?php
// require
require_once 'css_to_inline_styles.php';
// create instance
$cssToInlineStyles = new CSSToInlineStyles('<the-html-to-process-as-a-string>', '<the-css-to-use>');
// grab the processed HTML
$processedHTML = $cssToInlineStyles->convert();
?>
setCleanup
Should the IDs and classes be removed?
Parameters
- on bool (optional)
Return
void
setCSS
Set CSS to use
Parameters
- css string
- The CSS to use
Return
void
setHTML
Set HTML to process
Parameters
- html string
Return
void
setUseInlineStylesBlock
Set use of inline styles block
If this is enabled the class will use the style-block in the HTML.
Parameters
- on bool (optional)
Return