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
248 views
in Technique[技术] by (71.8m points)

css - Firefox problems with floated span inside <button>

I have not been able to make a html5 button with a span inside of it look alike in Chrome and FF. See the link below in FF and then in Chrome. The text "Login" is verticaly centered in Chrome but in FF the text is higher up. Line height can not be changed in FF with buttons.

When I try to solve this problem without using float another problem accurs whith the line-height and using font-size:30px in the span.

Check out the problem here

Oh, and I dont want to use images..

See Question&Answers more detail:os

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

1 Reply

0 votes
by (71.8m points)

The Firefox issue is this: Revisiting the Firefox button line-height bug... any 2011 solutions?

You can work around it by wrapping the text inside the button in a span, and adding the line-height to that:

<button><span>LOGIN</span><span class="a">?</span></button>

button span:first-child {
    line-height:35px;
}

See: http://jsbin.com/afezem/2

Or, you might prefer to slightly abuse the b element: http://jsbin.com/afezem/4

<button><b>LOGIN</b><span>?</span></button>

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

...