Smooth text align animation within box?

Viewed 25

Im trying to make a box that expands with content inside Is there a way i can make it so the h1 tag smoothly slides over to the left of the box when hover? and is there a way to make it on click instead of hover?

<html lang="en" dir="ltr">
  <head>
    <meta charset="utf-8">
    <title>Test</title>

  </head>
  <body>
<div class="coolbutton">
  <h1>HEADING</h1>
</div>
  </body>
<style>
.coolbutton{
  width: 250px;
  height:55px;
  background-color: black;
  border:solid;
  border-radius: 25px;
  margin: 10px;
  margin-bottom: 0px;
  text-decoration: underline 2px rgba(255, 255, 255, 0);
  transition: width 1s, height 1s, border-radius 1s, text-decoration 1s;
}
.coolbutton:hover{
  height: 150px;
  width: 300px;
  border-radius: 15px;
  text-decoration: underline 2px rgba(255, 255, 255, 1);
}
.coolbutton h1{
  color:white;
  font-size: 30px;
  margin:auto;
  margin-top: 5px;
  text-align: center;
.coolbutton:hover h1{
  text-align:left;
}
</style>
</html>```

0 Answers
Related