JSFiddle - React, Tailwind, and code Playground
HTML
<div class="container">
<div class="background">This is a test</div>
<textarea>This is a test</textarea>
</div>
<div class="container fixed">
<div class="background">This is a test</div>
<textarea>This is a test</textarea>
</div>
CSS
.container {
border: 1px solid #cdcdcd;
background: #f0f0f0;
width: 400px;
height: 50px;
position: relative;
margin: 24px 0;
}
.background {
position: absolute;
top: 0;
right: 0;
bottom: 0;
left: 0;
color: #f00;
}
textarea {
width: 100%;
height: 100%;
box-sizing: border-box;
background: transparent;
border: 0;
position: relative;
z-index: 2;
}
.background, textarea {
padding: 12px 5%;
font: 12px/1.6 Helvetica, Arial, sans-serif;
}
.container.fixed .background,
.container.fixed textarea {
padding: 12px 12px;
}