Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Line-height issue with firefox

I have a problem trying to make a search button looking fine on firefox. It's an input submit made with an iconic font, a white background and a border-radius like this:

display: block;
width: 60px;
height: 60px;
line-height: 60px !important;
padding: 0;
background: white;
border: 0;
border-radius: 30px;
-moz-border-radius: 30px;
-webkit-border-radius: 30px;
-khtml-border-radius: 30px;
font-family: 'iconic';
color: #bad104;
font-size: 5em;

It must look like this (chrome and IE renders perfectly my code) : http://img341.imageshack.us/img341/6590/kogy.png

But when i use the same code on firefox, here is what I get: http://img17.imageshack.us/img17/953/jms4.jpg

I looked on dom inspector on both browsers, and when i look at "calculated values", it doesn't renders the same thing on chrome (line-height: 60px) and firefox (line-height: 67px).

Everything I've tried from now is a fail :/ I hope you guys will have some help for me :)

Thanks !

like image 317
bigorno Avatar asked Jul 02 '13 10:07

bigorno


People also ask

What is browser default line height?

Desktop browsers (including Firefox) use a default value of roughly 1.2 , depending on the element's font-family . <number> (unitless)

How do I make text thicker in Firefox?

All Replies (2) Hi RichterB, You can change this in the Content Settings of Firefox. Go to "3 bar" menu and click on Options. Click on content and uncheck "Let websites choose their own styles" and select a bold font type.

How is line height calculated?

It takes the font-size value and multiplies it by 1.2 . Let's calculate the height of one line with the following example. We just have to do the following calculation: 16 * 1.5 = 24px. So we now know that our text will have a minimum height of 24px.

Is it possible to change the line height of a message?

If it's still necessary to modify line-height globally for all web content, it might be possible using a custom style rule (for example, using the Stylus extension ), but it may require a lot of adjustments for individual design patterns. In Thunderbird, it seems the problem is with the layout of the user interface and not the message content.

How do I change the line height to 2EM?

Here are some sample rules to try to universally change line-height to 2em: <pre>* { line-height: 2em !important; } html, body, div, section, article, p, span, th, td { line-height: 2em !important; } </pre> Some pages may override this with highly specific selectors that also have an !important rule.

Is the default font size of 9px too small?

A general font size of 9px is awfully small. The default font size is 16px and I suggest keeping that. As mentioned, you can apply custom style rules to web pages using the Stylus extension.

What is the best font size to use for a website?

A general font size of 9px is awfully small. The default font size is 16px and I suggest keeping that. As mentioned, you can apply custom style rules to web pages using the Stylus extension. You also can create a file named userContent.css, but that's a little more of a pain.


2 Answers

You shouldn't define a unit of measurement with line-height, this is so that the spacing is relative to the font size. In your example

line-height: 60px;

should be

line-height: 1;

or

line height: 100%;

as you are specifying that you want it to be the same height as the font.

like image 106
Colin Bacon Avatar answered Oct 01 '22 15:10

Colin Bacon


Button line-height in FF is hardcoded as line-height: normal !important; meaning that even a user defined line-height: xxx !important will not override it.

Give these a read:

https://bugzilla.mozilla.org/show_bug.cgi?id=349259

https://bugzilla.mozilla.org/show_bug.cgi?id=697451

like image 43
Jamie Kudla Avatar answered Oct 01 '22 16:10

Jamie Kudla