RonTheOld
RonTheOld

Reputation: 777

How to get a circle to go smaller on hover

Hi guys i am trying to get an effect such as this websites : Example so that when the user hovers over the circles in "HOW WE WORK" section , it gets smaller

However on my code for some reason i cant seem to get it to work at all and i have no idea why, im using bootstrap 3 :

HTML:

<div class="row icon-set">
    <div class="col-md-3 text-center">
    <p class="icon-container">
      <i class="fa fa-print"></i>
    </p>
        <p class="title"><span class="underline-text">Awesome</span>
        </p>
        <p>Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur.</p>
    </div>
</div>

CSS:

    .icon-set .fa-print  {
      font-size: 40px;
      position: absolute;
      transform: translate(-50%, -50%);
      top: 50%;
      left: 50%;
    }

    .icon-container {
      position: relative;
      height: 151px;
      width: 151px;
      border:2px solid #ccb08a;
      border-radius: 50%;
      margin: auto;
        color: #ccb08a;
    }

    .icon-container:hover  {
transform: scale(1);
    border: 1px solid;
    }

So im getting the border to change size but i cant get it go smaller at all like the example above,

Thanks for the help again

Upvotes: 0

Views: 75

Answers (2)

Maki
Maki

Reputation: 637

You can transform the size with transform:scale or directly setting the height & width size

transform: scale

    .icon-set .fa-print {
      font-size: 40px;
      position: absolute;
      transform: translate(-50%, -50%);
      top: 50%;
      left: 50%;
    }
    
    .icon-container {
      position: relative;
      height: 151px;
      width: 151px;
      border: 2px solid #ccb08a;
      border-radius: 50%;
      margin: auto;
      color: #ccb08a;
    }
    
    .icon-container:hover {
      transform: scale(1);
      border: 1px solid;
    }
<div class="row icon-set">
  <div class="col-md-3 text-center">
    <p class="icon-container">
      <i class="fa fa-print"></i>
    </p>
    <p class="title"><span class="underline-text">Awesome</span>
    </p>
    <p>Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur.</p>
  </div>
</div>


Height & Width method

    .icon-set .fa-print {
      font-size: 40px;
      position: absolute;
      transform: translate(-50%, -50%);
      top: 50%;
      left: 50%;
    }
    
    .icon-container {
      position: relative;
      height: 151px;
      width: 151px;
      border: 2px solid #ccb08a;
      border-radius: 50%;
      margin: auto;
      color: #ccb08a;
    }
    
    .icon-container:hover {
      border: 1px solid;
      height: 120px;
      width: 120px;
    }
<div class="row icon-set">
  <div class="col-md-3 text-center">
    <p class="icon-container">
      <i class="fa fa-print"></i>
    </p>
    <p class="title"><span class="underline-text">Awesome</span>
    </p>
    <p>Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur.</p>
  </div>
</div>

Upvotes: 0

jkythc
jkythc

Reputation: 430

You can use transform: scale to make the circle smaller when hover. See this jsfiddle

.icon-container {
  position: relative;
  height: 151px;
  width: 151px;
  border:2px solid #ccb08a;
  border-radius: 50%;
  margin: auto;
  color: #ccb08a;
  transform: scale(1);
  -webkit-transition: all .3s;
  -moz-transition: all .3s;
  transition: all .3s;
}

.icon-container:hover  {
  transform: scale(0.95);
  border: 1px solid;
}

Upvotes: 2

Related Questions