Change body 8px default margin in Angular 2

1

Good afternoon, I'm starting with Angular 2 and I'm having a problem removing the edges of the 8px body, I already tried to include it in the css margin: 0 body tag, but it did not work.

Could you help me?

Here is the body tag that is in my app component css

body,html {  
    margin: 0;
    font-family: "Montserrat Light";
    font-size: 16px;
    height: 100%;
    }

And here's the app.component.ts

import { Component } from '@angular/core';

@Component({
  selector: 'app-root',
  templateUrl: './app.component.html',
  styleUrls: ['./app.component.css']
})
export class AppComponent {

}
    
asked by anonymous 13.03.2017 / 16:06

3 answers

0

After installing normalize.css by typing:

npm install normalize.css

Do not forget to reference the file in your project. In the case of an angular design you can include the reference in the styles.css file, depending on the location would be something like:

@import 'node_modules/normalize.css/normalize.css' 
    
04.01.2019 / 21:41
1

To reset the styles of each browser, it is good practice to use nomalize.css, link . Another approach would be to add !important to the desired property, but this is considered a bad practice for CSS.

    
13.03.2017 / 18:12
0

I ended up installing Bootstrap through Angular / cli, I followed the following tutorial: Configuration link

Then I added Bootstrap in index.html:

<link href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css" rel="stylesheet">

It worked perfectly well! ;)

    
13.03.2017 / 20:26