<p>
<button type="button">Change display property</button>
</p>
<div id="wrapper">
<div id="div1" class="content">Lorem ipsum dolor sit amet, consectetur adipisicing elit. Hic, aliquam.</div>
<div id="div2" class="content">Lorem ipsum dolor sit amet, consectetur adipisicing elit. Doloribus, asperiores, vero dolorum earum sapiente dicta est iusto molestias placeat architecto. Rem neque obcaecati nostrum quae explicabo sint esse dolores quis!</div>
<div id="div3" class="content">Lorem ipsum dolor sit amet, consectetur adipisicing elit. Adipisci, iure ipsa dolorem iusto aliquid recusandae.</div>
</div>
body {
background-color: #333;
margin:1em;
}
#wrapper {
margin:0 auto;
}
.content {
padding:.5em;
float:left;
width:33.3%;
box-sizing: border-box;
}
.display_cell {
display: table;
}
.display_cell>.content {
display:table-cell;
float:none;
}
/* styling */
#div1 {
background-color: #defd90;
}
#div2 {
background-color: #f7abd9;
}
#div3 {
background-color: #9ed6f9;
}
p {
margin-bottom:2em;
text-align: center;
}
button {
font-size:1.5em;
padding:.3em;
}
document.getElementsByTagName('button')[0].onclick = function () {
var _wrapper = document.getElementById('wrapper');
if(_wrapper.classList.contains( 'display_cell')) {
_wrapper.classList.remove('display_cell');
} else {
_wrapper.classList.add('display_cell');
}
}
This Pen doesn't use any external CSS resources.
This Pen doesn't use any external JavaScript resources.