Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Align text and image inside button

Tags:

html

css

So i need to create a LIKE button. But i can't make my text and image aligned by middle center. +this % responsivness is dravin me crazy.

Maybe im doing something too hard and someone can rewrite easier and explain to me. But i want the button to scale with % so responsive.

This is what i want
enter image description here
This is what i have at the moment
enter image description here

    .kom_augsha .treshais{
    	width:15%;
    	float:right;
    }
    
    .reitings{
      display:table;
      width: 100%;
      border: 1px solid #e9e9e9;
      
    }
    
    .rate {
      display: table-cell;
      text-align: center;
      vertical-align:middle;
      line-height: 1.5em;
    }
    
    .plus {
      background: white;
      color: green;
    }
    
    .minus{
      background: white;
      color: red;
      border-left: 1px solid #e9e9e9;
      padding-left:10px;
      text-align:center;
    }
<div class="treshais">
  <div class="reitings">
    <div class="rate plus"><img src="plus.jpg"/>83</div>
    <div class="rate minus"><img src="minus.jpg"/>9</div>
  </div>
</div>
like image 527
Roberts Šensters Avatar asked Aug 27 '15 12:08

Roberts Šensters


1 Answers

You can use this:

.rate img {vertical-align: middle;}
like image 170
Praveen Kumar Purushothaman Avatar answered Sep 23 '22 03:09

Praveen Kumar Purushothaman