Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

CSS overflow:hidden creating margin at bottom

Tags:

html

css

When I add

overflow:hidden

to any of the buttons on my page, it creates 13px of margin at the bottom of the button. When I remove the above CSS, the margin disappears, however some content inside the button overflows.

How can I remove the margin at the bottom, while keeping the

overflow:hidden

CSS style?

WITH overflow:hidden hidden

WITHOUT overflow:hidden without

, however, the Facebook logo overflows into the next button (it is a custom font)

CURRENT BUTTON CSS:

.btn {
    background-color: #FF6347;
    border: 1px solid #CC4F39;
    color: #FFFFFF;
    text-decoration: none;
    padding: 7px 15px;
    cursor: pointer;
    font-size: 1em;
    text-shadow: 0 1px 2px #000000;
    display: inline-block;
    overflow: hidden;
}

CURRENT BUTTON HTML:

<a class="btn btn-fb btn-xl" id="login_fb"><span class="icon-socialfacebookvariant"></span>Log In</a>

CURRENT FACEBOOK LOGO CSS:

[class^="icon-"], [class*=" icon-"] {
    overflow:hidden;
}

[class^="icon-"]:before, [class*=" icon-"]:before {
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    font-size:2em;
    line-height:0;
    font-family: 'icomoon';
    position:relative;
    top:-1px;
    speak: none;
    font-style: normal;
    font-weight: normal;
    font-variant: normal;
    text-transform: none;
    vertical-align:middle;
}

// Facebook logo from a font
.icon-socialfacebookvariant:before {
    content: "\e9e3";
}
like image 399
zuc0001 Avatar asked Jul 25 '15 12:07

zuc0001


1 Answers

Thanks Jaunt for the help.

Although your idea is the most logical, it's not very nice when editing!

Luckily I happened to come across a simple fix to my problem!

All I had to do was add vertical-align:top to my button CSS, and wham! it works!

Thanks for your help :)

like image 169
zuc0001 Avatar answered Nov 15 '22 07:11

zuc0001