# Use css transition to animate an external element

**URL:** <https://forum.freecodecamp.org/t/use-css-transition-to-animate-an-external-element/164859>\
**Category:** General\
**Created:** [December 21, 2017, 10:53pm UTC](https://forum.freecodecamp.org/t/use-css-transition-to-animate-an-external-element/164859 "2017-12-21T22:53:20Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![hadrienallemon](https://avatars.discourse-cdn.com/v4/letter/h/4491bb/32.png) [@hadrienallemon](https://forum.freecodecamp.org/u/hadrienallemon)\
**Post date:** [December 21, 2017, 10:53pm UTC](https://forum.freecodecamp.org/t/use-css-transition-to-animate-an-external-element/164859/1 "2017-12-21T22:53:20Z")

</div>

Hello everyone !

I was messing around with css transitions, that i find fantastics, but I was wondering wether it was possible to use transitions on one CSS elements onto another. For exemple, let’s imagine we have to box, one green and one blue, would it be possible to hover over one box to change the color of the other ? Something like

```auto
.greenbox {
    background-color : green;
    transition : background-color 2s;

}

.bluebox:hover {
    .greenbox {
     background-color : red;
     }
}

```

---

<div class="post-metadata">

**Author:** ![ILM](https://sea3.discourse-cdn.com/freecodecamp/user_avatar/forum.freecodecamp.org/ilm/32/363239_2.png) [@ILM](https://forum.freecodecamp.org/u/ILM)\
**Post date:** [January 16, 2021, 11:26am UTC](https://forum.freecodecamp.org/t/use-css-transition-to-animate-an-external-element/164859/2 "2021-01-16T11:26:03Z")

</div>

Closed on January 16, 2021, 11:26am UTC


