Leyli Abbasova Leyli Abbasova - 2 months ago 18
CSS Question

Angular md-button destroys alignment

When i don't insert md-button everything works perfectly. But when I add md-button, span doesn't work properly. The number "5" goes down. How can I solve this problem?

HTML:

<button md-button class="special-orders">xüsusi təkliflər <span>5</span></button>


CSS:

.special-orders {
font-size: 15px;
color: white;
span {
font-size: 11px;
display:inline-block;
width: 15px;
height: 15px;
text-align: center;
color: #FF2868;
background-color: white;
border-radius: 50%;
vertical-align: middle;
padding: 0;
}
}


enter image description here

Answer Source

The material styling sets the line-height on the button to 36px which seems to be causing the problem with the span having a fixed height and width. Setting the line height on the span as well is easier than trying to line everything up.

    .special-orders {
      font-size: 15px;
      color: white;
      span {
        line-height: 18px;
        width: 18px;
        display:inline-block;
        text-align: center;
        color: #FF2868;
        background-color: white;
        border-radius: 50%;
        vertical-align: middle;
        padding: 0;
      }
    }