Qiita Teams that are logged in
You are not logged in to any team

Log in to Qiita Team
Community
OrganizationEventAdvent CalendarQiitadon (β)
Service
Qiita JobsQiita ZineQiita Blog
1
Help us understand the problem. What are the problem?

More than 1 year has passed since last update.

@kanora

bootstrapでプラスからマイナスへ変化するアイコンを作る

最近

最近はコロナのせいで引きこもっています。楽しみがパンケーキを作ることしかないです。何かちょうど良い趣味教えてください。

bootstrapでプラスからマイナスに変化するアイコンを作る

まずはHTML

index.html
<div class="" id="collapseListGroupHeading">
  <a href="#switch" class="collapsed" data-toggle="collapse"></a>
  <div class="collapse" id="switch" aria-expanded="false">
  </div>
</div>

そしてCSS

style.css
#collapseListGroupHeading a[data-toggle="collapse"]{
  padding: 10px;
  text-decoration: none;
  position: relative;
}
#collapseListGroupHeading a[data-toggle="collapse"]::before,
#collapseListGroupHeading a[data-toggle="collapse"]::after{
  content:"";
  width: 8px;
  height: 0;
  border-top: #000000 1px solid;
  border-bottom: #000000 1px solid;
  position: absolute;
  right: 15px;
  top: 12px;
  bottom: 12px;
  margin: auto;
}
#collapseListGroupHeading a[aria-expanded=false]::after{
  -webkit-transform: rotate(90deg);
  -ms-transform: rotate(90deg);
  transform: rotate(90deg);
  transition-duration: 0.3s;
}
#collapseListGroupHeading a[aria-expanded=true]::after{
  -webkit-transform: rotate(0deg);
  -ms-transform: rotate(0deg);
  transform: rotate(0deg);
  transition-duration: 0.3s;
}
Why not register and get more from Qiita?
  1. We will deliver articles that match you
    By following users and tags, you can catch up information on technical fields that you are interested in as a whole
  2. you can read useful information later efficiently
    By "stocking" the articles you like, you can search right away
1
Help us understand the problem. What are the problem?