⊗jsagPmStCm 45 of 97 menu

Angular Component Styles

Now let's style our layout via CSS. For this, we will need the file app.component.css, in which CSS styles for the component layout are written. At the same time, Angular itself takes care of the styles working as a CSS module. This means that all selectors will work only for the component layout and will not capture the layout from the outside.

Let's look at it in practice. Let's say our component has the following layout:

<div> abcde </div>

Let's set the color of the diva:

div { color: red; }

In this case, we can be sure that the style will be applied only to the divs from our component, and not to any others.

Make some layout in the template file. Write styles for this layout.

enru