-1

I want to take fixed size of a picture. I tested this code:

  .icon4 {
  display: inline-block;
  width: 270px;
  height: 270px;
  text-align: center;
  color: #fff;
  font-size: 130px;
  line-height: 130px;
  /*padding: 33px 20px 30px;*/
  max-width: 100%; }
  .icon2:before {
    display: inline-block; }
  .icon2.fa-shekel {
    background: #4884f2; }
  .icon2.fa-compass {
    background: #d24f4f; }

<div class="icon4">
  <img src="http://st2.depositphotos.com/1058504/12481/i/450/depositphotos_124811492-Two-businesspeople-discussing-work-in.jpg" alt="" />
</div>

https://jsfiddle.net/be70nhyb/

When I have pictures with different size the end result is images different size.

How I can take only fixed size from the picture?

Albzi
  • 15,431
  • 6
  • 46
  • 63
Peter Penzov
  • 1,126
  • 134
  • 430
  • 808

2 Answers2

0

add "overflow:hidden;" to .icon4

Darango
  • 84
  • 3
0

I think you need to give width and height to image like this:

.icon4 img { 
    width: 270px;
    height: 240px;
 }
kukkuz
  • 41,512
  • 6
  • 59
  • 95