I'm trying to add a vertical separator between an icon and some text on a button, but it is just pushing everything down. Why is that?
.btn {
height: 22px;
border: 1px solid #B9B9B9;
font-weight: normal;
font-size: 11px;
color: #003E7E;
text-align: left;
line-height: 12px;
width: 200px;
}
.separator {
content: '';
display: inline-block;
background: #888;
margin: 0px 4px;
height: 18px;
width: 1px;
}
<link href="http://netdna.bootstrapcdn.com/font-awesome/3.2.1/css/font-awesome.css" rel="stylesheet"/>
<link href="http://netdna.bootstrapcdn.com/bootstrap/3.0.0/css/bootstrap-glyphicons.css" rel="stylesheet"/>
<link href="http://maxcdn.bootstrapcdn.com/bootstrap/3.3.1/css/bootstrap.min.css" rel="stylesheet"/>
<button type="button" class="btn">
<span class="icon-plus"></span>
<span class="separator"></span>
ABC0102165
</button>
I would add "padding-top: 0px !important;" to .btn, and "vertical-align: top;" to .separator.
.btn {
height: 22px;
border: 1px solid #B9B9B9;
font-weight: normal;
font-size: 11px;
color: #003E7E;
text-align: left;
line-height: 12px;
width: 200px;
padding-top: 0px !important;
}
.separator {
content: '';
display: inline-block;
background: #888;
margin: 0px 4px;
height: 18px;
width: 1px;
vertical-align: top;
}
<link href="http://netdna.bootstrapcdn.com/font-awesome/3.2.1/css/font-awesome.css" rel="stylesheet"/>
<link href="http://netdna.bootstrapcdn.com/bootstrap/3.0.0/css/bootstrap-glyphicons.css" rel="stylesheet"/>
<link href="http://maxcdn.bootstrapcdn.com/bootstrap/3.3.1/css/bootstrap.min.css" rel="stylesheet"/>
<button type="button" class="btn">
<span class="icon-plus"></span>
<span class="separator"></span>
ABC0102165
</button>