Html 去掉 -webkit-padding-start: 40px

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/29307357/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-29 03:43:51  来源:igfitidea点击:

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

htmlcssmenuwebkit

提问by sqe

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.

我正在向地图添加菜单。菜单工作正常,但我注意到无论应用到菜单的 CSS 是什么,左边总是有一个填充。填充似乎源自 (-webkit-padding-start: 40px;) 并且它不想消失。我试图用0 !important;没有做任何事情的方式覆盖它。

After Googling found this:

谷歌搜索后发现:

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

-webkit-padding-start: 40px; IE 和 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;

附上截图,绿色区域是我所说的,在样式下你可以看到 -webkit-padding-start: 40px;

回答by sqe

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

这是因为每个浏览器的用户代理样式表。作为第一步,您应该始终重置 css 中的所有属性。

Short solution:

简短的解决方案:

* {
  margin: 0;
  padding: 0;
}

/* your styling */

Longer solution:

更长的解决方案:

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

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

回答by Sanuich

for firefox:

对于火狐:

-moz-padding-start: 0px;