JSFiddle - React, Tailwind, and code Playground
HTML
<div class="main"></div>
<div class="sidebar"></div>
<div class="btn">click to unwrap</div>
CSS
.main {
width: 200px;
height: 3rem;
background-color: #f00;
}
.sidebar {
width: 100px;
height: 3rem;
background-color: #00f;
}
.test {
padding: 1rem;
background-color: #000;
display: flex;
flex-flow: row wrap;
}
.btn {
width: 10rem;
height: 1.5rem;
background-color: #ccc;
text-align: center;
border-radius: 5px;
position: fixed;
top: 50%;
left: 50%;
transform: translate(-50%,-50%);
box-shadow: 0 1px 5px rgba(0,0,0,.8);
}
JavaScript
$(function() {
$(".main, .sidebar").wrapAll("<div class='test'>");
$(".btn").on("click", function(){
$(".main").unwrap();
});
});