2

I added the following code to the global styles.css to have a lightblue background color.

html, body{
 background-color: lightblue ;
}

When I refresh the home.component page, I see lightblue screen briefly, then I get the home.component without the lightblue background.

What can cause the background color to be overriden by the home.component. I have no css file for home.component or app.component.

Update: I did, F12, element tab, filter on background. I see where the white color is overriding the style.css background color. It appears that the aws-amplify code is overriding my lightblue background color in styles.css

enter image description here

enter image description here

2
  • There's not enough context in your question, but you can try this background-color: lightblue !important; first. The color flashing could be attributed to your styles loading and getting applied first, and Angular's - second. Commented Jul 17, 2019 at 23:13
  • Most likely, you would have to provide a higher level of specificity for your CSS selector. See this for more details. Commented Jul 17, 2019 at 23:16

1 Answer 1

1

The use of !important is a poor solution. You have most likely a css sheet overiding background-color property (check bootstrap if you are using it). The best solution to fix it is opening console in your browser and check manually.

To do it :

  • press f12
  • click on top element
  • filter by background property
  • you will now be able to see which stylsheet is defining background color

You should see something like that.

Screenshot of console in Chrome

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

2 Comments

Paul, your way is outstanding. It appears the white background is coming from aws-amplify component. I will edit my post to add the pictures.
It appears the amplify-angular component is overriding the background color in angular.css file

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.