question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

SyntaxErr on <h1> with !important

See original GitHub issue

Feeding the following into transform() results in a SyntaxErr:

<style type="text/css">
h1 { border:1px solid black }
p { color:red;}
</style>
<p>Hey</p>
<h1 style="display: block;font-family: Helvetica;font-size: 26px;font-style: normal;font-weight: bold;line-height: 100%;letter-spacing: normal;margin-top: 0;margin-right: 0;margin-bottom: 10px;margin-left: 0;text-align: left;color: #202020 !important;">Some Stuff</h1>

Results in:

SyntaxErr: PropertyValue: Missing token for production Choice(ColorValue, Dimension, URIValue, Value, variable, MSValue, CSSCalc, function): ('CHAR', '!', 1, 230)

Removing the !important from the inline style on the H1 allows it to be inlined as expected.

Issue Analytics

  • State:closed
  • Created 8 years ago
  • Comments:20 (17 by maintainers)

github_iconTop GitHub Comments

1reaction
peterbecommented, Nov 30, 2015

For your information, Gmail does need !important for certain things such as display:none. But that apparently breaks Outlook: https://github.com/peterbe/premailer/issues/150

0reactions
elidickinsoncommented, Oct 2, 2016

That may happen to work in some browsers, but is it to the spec? I’m under the impression it is not technically valid HTML/CSS…

Regardless you probably don’t ever want to use inline !important in emails: https://www.campaignmonitor.com/blog/email-marketing/2010/05/outlook-2007-and-the-inline-important-declaration/

On Oct 2, 2016 5:56 AM, “Christof” notifications@github.com wrote:

Basically, putting !important in an inline style doesn’t make sense because nothing is more important than inline styles already.

Sorry, not true. See http://jsbin.com/vurufej/edit?html,css,output

Stylesheet !imporant overwrites inline style attributes and only if these are !important too cannot be overwritten.

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/peterbe/premailer/issues/133#issuecomment-250963390, or mute the thread https://github.com/notifications/unsubscribe-auth/AACuz25-ETMJdfAkecPMWaTDNgg7gTq2ks5qv3_hgaJpZM4Fn2wY .

Read more comments on GitHub >

github_iconTop Results From Across the Web

Sass syntax error issue [duplicate] - css - Stack Overflow
I just started SASS studying and i met a problem. When i set a variable and wanted to use it, i got an...
Read more >
HTML or CSS Syntax Error - Off Topic - Codecademy Forums
Using <mark></mark> in a heading is redundant. The <h2></h2> gives it importance. That combinator is a descendant selector. with no space ...
Read more >
syntax error, unexpected '{' in C:\xampp\htdocs\code\contact ...
items. The error means that it came across '{' when it wasn't ready - missing '}' and more than one is missing.
Read more >
Syntax Error Due to Incorrect Generated HTML File #11 - GitHub
Running mkdocs build reverts it back to code and so syntax errors start occurring again. Attaching my yml file for reference: site_name: My...
Read more >
jQuery and Ajax Tutorial
The error script simply returns false and stops working with no clue at all! You need a debugger to catch syntax error for...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found