1

If I have a css code section { margin-left: 80px; } in global css and If I need to change the code into margin-left: 40px; by using local css code. Is it possible to do it?

Is it possibly to change the global css code by using local javascript and local css code?

A sample is provided:
https://stackblitz.com/edit/angular-85deej

Thank you!

HelloWorld1
  • 13,688
  • 28
  • 82
  • 145

2 Answers2

1

I would suggest you read about view encapsulation here for more information.

Try this:

::ng-deep section { margin-left: 80px; }

Check the stackblitz here

Athanasios Kataras
  • 25,191
  • 4
  • 32
  • 61
  • 1
    `::ng-deep` is marked as deprecated and will be removed at some point, you should try to avoid it as much as possible. – Ploppy Nov 17 '19 at 09:21
-1

Try margin-left: 40px!important; in your local css, it will override global css property.

Sabith
  • 1,628
  • 2
  • 20
  • 38