<p>You can include standard HTML in Twig templates. So something like this would work:</p>

<pre><code>&lt;table style="background-color: gray"&gt;
</code></pre>

<p>You don't <strong>have</strong> to use Twig filters to add CSS or CSS files. Although you could create some CSS variables using <code>{% set gray = '#eee' %}</code> or <code>{% set border = 'border: 1px solid black' %}</code> for repeated styles such as colors, borders, etc., and then reference those like this, using the variable name:</p>

<pre><code>&lt;table style="background-color: {{ gray }}; {{ border }}&gt;
</code></pre>

CC BY-SA 4.0
2018-12-06T23:49:26.620Z
2018-12-06T23:49:26.620Z
Jon Weedin
<p>I'm trying to create an email newsletter template to make it easier to send out blog newsletters by looping over entries and generating the email straight out of craft. I did this often with Wordpress.</p>

<p>However I'm getting twig syntax errors because of the inline CSS. I know you can do this <code>&lt;style&gt;{{ source('file.css') }}&lt;/style&gt;</code> but that's not going to cut it for all the tables I need to add inline CSS to. </p>

<p>Am I missing a Twig filter that I could wrap all my HTML code it? </p>

<p>Just to be clear I am only trying to generate, not send the email newsletter through Craft. </p>

<emails>
Custom Newsletter template
# Custom Newsletter template

(Asked by: username_0 on 2018-12-06)

I'm trying to create an email newsletter template to make it easier to send out blog newsletters by looping over entries and generating the email straight out of craft. I did this often with Wordpress.

However I'm getting twig syntax errors because of the inline CSS. I know you can do this  but that's not going to cut it for all the tables I need to add inline CSS to.

Am I missing a Twig filter that I could wrap all my HTML code it?

Just to be clear I am only trying to generate, not send the email newsletter through Craft.

**Tags:** emails


---

## 1 answers

### Answer by username_1 on 2018-12-06. Score: 1 | Accepted answer

You can include standard HTML in Twig templates. So something like this would work:


You don't have to use Twig filters to add CSS or CSS files. Although you could create some CSS variables using {% set gray = '#eee' %} or {% set border = 'border: 1px solid black' %} for repeated styles such as colors, borders, etc., and then reference those like this, using the variable name:
<table style="background-color: {{ gray }}; {{ border }}>


---

