JSFiddle - React, Tailwind, and code Playground
HTML
<div class="container">This is a normal container that should have a transition for margin only.</div>
<div class="container">This is a normal container that should have a transition for margin only.</div>
<div class="container">This is a normal container that should have a transition for margin only.</div>
<div class="container t-padding">This is a container with .t-padding and should have a transition for padding and margin.</div>
<div class="container t-padding">This is a container with .t-padding and should have a transition for padding and margin.</div>
<div class="container t-padding">This is a container with .t-padding and should have a transition for padding and margin.</div>
<div class="container">This is a normal container that should have a transition for margin only.</div>
<div class="container">This is a normal container that should have a transition for margin only.</div>
<div class="container">This is a normal container that should have a transition for margin only.</div>
CSS
.container {
padding: 8px 13px;
background: #000033;
color: white;
transition: margin 1s;
cursor: pointer;
}
.container.t-padding {
background: #003300;
}
.container.t-padding {
transition: padding 1s, margin 1s;
}
.container:hover {
margin: 10px 0;
}
.container.t-padding:hover {
padding: 20px 13px;
}