1

On my layout page, in the <head>, I have the following styles:

<link rel="stylesheet" href="/dist/vendor.css">
<style>
    .bg-dark {
        background-color: #240000; 
    }
</style>

I have added the link to my layout page. The style block is added dynamically by Angular & webpack. From what I know about CSS, that last .bg-dark class should win over any .bg-dark class declared in `vendor.css. Yet I see the following:

Incorrect order of precedence

Is this something caused by the magical pre-rendering of Angular? Is there some way to prevent this?

1
  • 1
    !important Always wins Commented Nov 18, 2017 at 20:34

1 Answer 1

5

The background-color attribute in vendor.css has the !important flag, which elevates its priority:

background-color: #222222 !important;

To override that setting, you should set the !important flag in your layout page CSS:

<style>
    .bg-dark {
        background-color: #240000 !important; 
    }
</style>

or remove that flag in vendor.css, if your can.

Sign up to request clarification or add additional context in comments.

1 Comment

Cant believe I missed that.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.