rafaelmorais
rafaelmorais

Reputation: 1383

Firefox button gets bigger

I have a button and an anchor tag booth using the same class, but the button gets bigger for some reason. I found a question here already solved but it still is a little bit bigger than the other.

HTML:

<div class="item-actions">
    <ul>
        <li><a href="#" class="button"><i class="fa fa-trash"></i> Gravar</a></li>
        <li><button type="submit" class="button"><i class="fa fa-trash"></i> Lixo</button></li>
    </ul>
</div>

CSS:

.item-actions{
    float: right;
}

.item-actions ul li{
    display: inline-block;
}
.button {
    background: #3a9665;
    background-image: -webkit-linear-gradient(top, #3a9665, #2d7a51);
    background-image: -moz-linear-gradient(top, #3a9665, #2d7a51);
    background-image: -ms-linear-gradient(top, #3a9665, #2d7a51);
    background-image: -o-linear-gradient(top, #3a9665, #2d7a51);
    background-image: linear-gradient(to bottom, #3a9665, #2d7a51);
    -webkit-border-radius: 2;
    -moz-border-radius: 2;
    border-radius: 2px;
    font-family: Arial;
    color: #ffffff;
    font-size: 12px;
    padding: 4px 12px 4px 12px;
    border: solid #2d7a51 1px;
    text-decoration: none;
}

.button:hover {
    background: #2d7a51;
    text-decoration: none;
}

Here I found a Solution so I added this bit of CSS:

button::-moz-focus-inner {
    padding: 0;
    border: 0
} 

But the result still isn't what I want, you will notice some difference in the following screenshot: screenshot

EDIT: I've removed i tags and the problem still exists, so thats not the problem.

Upvotes: 1

Views: 87

Answers (2)

Giacomo1968
Giacomo1968

Reputation: 26066

I can recreate the issue on Mac OS X 10.9.5 with FireFox version 32.0.2. Adding line-height: 1em; to .button seems to work when I test it in FireFox:

.button {
    background: #3a9665;
    background-image: -webkit-linear-gradient(top, #3a9665, #2d7a51);
    background-image: -moz-linear-gradient(top, #3a9665, #2d7a51);
    background-image: -ms-linear-gradient(top, #3a9665, #2d7a51);
    background-image: -o-linear-gradient(top, #3a9665, #2d7a51);
    background-image: linear-gradient(to bottom, #3a9665, #2d7a51);
    -webkit-border-radius: 2;
    -moz-border-radius: 2;
    border-radius: 2px;
    font-family: Arial;
    color: #ffffff;
    font-size: 12px;
    line-height: 1em;
    padding: 4px 12px 4px 12px;
    border: solid #2d7a51 1px;
    text-decoration: none;
}

I believe the issue’s cause comes from <button type="submit" class="button"> tag having explicit styling while your <a href="#" class="button"> doesn’t:

<div class="item-actions">
    <ul>
        <li><a href="#" class="button"><i class="fa fa-trash"></i> Gravar</a></li>
        <li><button type="submit" class="button"><i class="fa fa-trash"></i> Lixo</button></li>
    </ul>
</div>

Also could be caused by the use of explicit pixel sizing in .button with font-size: 12px;. I would recommend using another scheme for sizing such as em’s or even percentages.

Upvotes: 1

Salmen Bejaoui
Salmen Bejaoui

Reputation: 865

try to set the line-height of icons to 1:

.fa {
    line-height: 1;
}

Upvotes: 1

Related Questions