Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
628 views
in Technique[技术] by (71.8m points)

css - How to reset default button style in Firefox 4 +

In firefox 3.6 you could use ::-moz-focus-inner {border:0;padding:0;margin:0;} to remove those default margins and paddings forms.css added.

How can I reset this in Firefox 4? I've been searching for any .css files inside the install directory that could add styles to my button but can't find any for ff4 - the button still gets that annoying 1px top padding that won't allow the text to align to vertical middle.

http://easwee.net/other/FF_problem.gif

EDIT: I use a reset stylesheet so no need to reset styles. It's a browser stylesheet that's messing here.

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

I actually found the solution myself.

In your url field type: resource://gre-resources/forms.css - this will open forms.css for FF4 - and search for the following selector

button::-moz-focus-inner,
input[type="reset"]::-moz-focus-inner,
input[type="button"]::-moz-focus-inner,
input[type="submit"]::-moz-focus-inner,
input[type="file"] > input[type="button"]::-moz-focus-inner

Now just put that in your main stylesheet like:

button::-moz-focus-inner,
input[type="reset"]::-moz-focus-inner,
input[type="button"]::-moz-focus-inner,
input[type="submit"]::-moz-focus-inner,
input[type="file"] > input[type="button"]::-moz-focus-inner {border:0;padding:0;margin:0;}

It shouldn't be overriding your css anymore. Also note that if you haven't defined any font style for your inputs FF won't inherit body font styling.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...