Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

168
Views
How to achieve rotating only border and not the icon using CSS

I am trying to rotate my border 135 deg on hover but icon rotate also and i want ONLY the border, i post the code if you can help me i will appreciate it,Thank you!

 My html: `
    <div class="container-fluid details-section">
      <div class="row justify-content-center h-100">
       <div class="col-xl-2 my-auto box text-center">
          <i class="fa fa-guitar"></i>
      </div>
       <div class="col-xl-2 my-auto box text-center">
          <i class="fa fa-guitar"></i>
       </div>
       <div class="col-xl-2 my-auto box text-center">
          <i class="fa fa-guitar"></i>
       </div>
      </div>
    </div>`

    And CSS: 
    
        `.details-section{
          background-color: rgb(83, 83, 83);
          height: 200px;
        }
        
        
        .box i{
          font-size: 70px;
          border: 2px solid #c49b63;
          color: black;
        }
    .box:hover i{
      transform: rotate(135deg);
    }
    `
about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

Here's an option with reverse transform. I updated the HTML to rotate an inner element instead of the .box itself to separate the bootstrap elements from the rotating elements.

.details-section {
  background-color: rgb(83, 83, 83);
  height: 200px;
}

.icon-container {
  border: 2px solid #c49b63;
  transition: 0.5s linear;
}

.box i {
  font-size: 70px;
  color: black;
  transition: 0.5s linear;
}

.icon-container:hover {
  transform: rotate(135deg);
}

.icon-container:hover i {
  transform: rotate(-135deg);
}
<link href="https://cdnjs.cloudflare.com/ajax/libs/bootstrap/4.6.1/css/bootstrap.min.css" rel="stylesheet" />
<link href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.0.0/css/all.min.css" rel="stylesheet" />
<div class="container-fluid details-section">
  <div class="row justify-content-center h-100">
    <div class="col-sm-2 my-auto box text-center">
      <div class="icon-container">
        <i class="fa fa-guitar"></i>
      </div>
    </div>
    <div class="col-sm-2 my-auto box text-center">
      <div class="icon-container">
        <i class="fa fa-guitar"></i>
      </div>
    </div>
    <div class="col-sm-2 my-auto box text-center">
      <div class="icon-container">
        <i class="fa fa-guitar"></i>
      </div>
    </div>
  </div>
</div>

about 4 years ago · Juan Pablo Isaza Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!