AppDreamer
AppDreamer

Reputation: 1426

Angular5 Remove Default Padding

I have started a default Angular 5 CLI app...

ng new testApp

I then changed the background app.component.html to gray so you can see my issue...

<div style="text-align:center; background:gray">

The default app always has these unnecessary gaps (margins? padding?) between the browser's edge and the first level of content (container?). What is the easiest, most direct way to remove these gaps completely? There should be a single value I can change somewhere to fix this, right?

enter image description here

Upvotes: 0

Views: 1411

Answers (3)

Waldo Pimentel
Waldo Pimentel

Reputation: 341

Use in app.component.scss

::ng-deep * {
  margin: 0;
  padding: 0;
}

Upvotes: 0

One Qode
One Qode

Reputation: 26

This space is the margin of the body and the margin of

<h1> Welcome to app! </h1>

Upvotes: 1

Daniel A. White
Daniel A. White

Reputation: 190905

Some browsers have body margins. Set those to 0.

Upvotes: 0

Related Questions