Skip to content

Inline important styles can be overwritten by non-inline important styles #637

@sakurai-youhei

Description

@sakurai-youhei

Inline styles with the !important rule is weaker than other important styles.

<html>
  <head>
    <style>h1 { color:blue !important; }</style>
  </head>
  <body>
    <h1 style="color:red !important;">Big Text</h1>
  </body>
</html>

Current output:

<html><head>
    
  </head>
  <body>
    <h1 style="color: blue">Big Text</h1>
  
</body></html>

Expected output:

<html><head>
    
  </head>
  <body>
    <h1 style="color: red">Big Text</h1>
  
</body></html>

My references:

https://developer.mozilla.org/en-US/docs/Web/CSS/Reference/Values/important#inline_styles
... Inline important styles take precedence over all other important author styles, no matter the layer, but important styles from user's or user-agent's style sheets and transitions override them.

Screenshot from Chrome DevTools

Image

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions