<div class="container">
<div class="preview div"></div>
<pre class="preview pre"></pre>
<code class="preview code"></code>
</div>
body {
display:flex;
margin: 0;
justify-content: center;
align-items: center;
padding: 0 10px;
box-sizing: border-box;
min-height: 100vh;
}
.container {
display: flex;
width: 100%;
}
.preview {
flex: 1;
margin-bottom: 20px;
padding: 20px;
background: #f5fcff;
border: 1px solid #d3eeff;
border-radius: 3px;
margin: 0;
}
.preview + .preview {
margin-left: 10px;
}
const previews = ['div', 'pre', 'code']
var userInfo = {name: 'anran758',github: 'https://github.com/anran758'};
var info = JSON.stringify(userInfo, null, 2);
previews.forEach(name=> {
const preview = document.querySelector('.' + name);
preview.innerHTML = info
})
console.log(preview);
This Pen doesn't use any external CSS resources.
This Pen doesn't use any external JavaScript resources.