Get rid of -webkit-padding-start: 40px

2019-03-09 19:54发布

I am working on adding a menu to a map. The menu is working fine except I noticed there is always a padding to the left no matter what CSS applied to the menu. The padding seems to be originated from (-webkit-padding-start: 40px;) and it does not want to go away. I tried to override it with 0 !important; that didn't do anything.

After Googling found this:

-webkit-padding-start: 40px; What it should be for IE and Firefox?

However could not find anything else on how to override or make this go away. I need to have items in the menu all the way to the left.

enter image description here

Attached is a screenshot, green area is what I am talking about and under styles you can see -webkit-padding-start: 40px;

2条回答
Lonely孤独者°
2楼-- · 2019-03-09 19:57

It's because of the user-agent stylesheets of every browser. You should always reset all attributes in your css as your first step.

Short solution:

* {
  margin: 0;
  padding: 0;
}

/* your styling */

Longer solution:

http://meyerweb.com/eric/tools/css/reset/

查看更多
时光不老,我们不散
3楼-- · 2019-03-09 20:03

for firefox:

-moz-padding-start: 0px;
查看更多
登录 后发表回答