Youlfey
Youlfey

Reputation: 605

How to remove default margin in angular app?

Very simple app.component.html:

<input type="submit" value="Sub"/>

The result of the code above

enter image description here

How to remove margin arround the button? I want the button is located on the top left without indent.

Upvotes: 7

Views: 16938

Answers (5)

Waldo Pimentel
Waldo Pimentel

Reputation: 341

Use in app.component.scss

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

Upvotes: 19

Cristian
Cristian

Reputation: 21

You have to go to the styles.css of the proyect and write body{ margin:0; padding:0; } and that's it, it's simple Hope it works, this was the way I solved the problem

Upvotes: 2

Ved_Code_it
Ved_Code_it

Reputation: 774

If you want to fix it at top left forcefully without removing any margin padding in container. Add style to it position:fixed;top: 0;left: 0; Or set html, body{ padding: 0px;margin: 0px;} in your style.css file

Upvotes: 1

Dhaval
Dhaval

Reputation: 389

That is not from angular, it is added by browser. You have to reset css

Upvotes: -1

Youlfey
Youlfey

Reputation: 605

Why does angular use what default padding?

Problem resolved!

I added this code in the global styles:

body {
  margin: 0;
  padding: 0;
}

Upvotes: 18

Related Questions