Hello,
I am working on my markdown previewer and wondering how to get a text area to conform to a container.
This is what the HTML currently looks like. As you can see, the textarea has a extra margin at the bottom, and despite having a width of 100%, goes over the edge of my container.
My HTML has a container that has container items inside. Each of these container items has two elements: A banner at the top and a textarea.
<body>
<h1>Markdown Previewer</h1>
<div class="container">
<div class="container-item">
<div class="container-item-banner">
<p>Editor</p>
</div>
<textarea id="editor"></textarea>
</div>
<div class="container-item">
<div class="container-item-banner">
<p>Preview</p>
</div>
</div>
</div>
</body>
My CSS uses a lot of flexbox to center items. The container item has zero padding (L28) and my textarea is restricted to a width of 100% with only vertical re-size.
.container {
margin: 0 auto;
display: flex;
flex-direciton: row;
justify-content: center;
align-items: flex-start;
gap: 5%;
}
.container-item {
width: 100%;
max-width: 750px;
min-width: 250px;
height: 100%;
border: 1px solid black;
background-color: transparent;
box-shadow: 2px 2px 5px black;
padding: none;
}
.container-item-banner {
width: 100%;
font-size: 20px;
background-color: #949bd1;
height: 50px;
display: flex;
flex-direction: column;
justify-content: center;
align-items: center;
}
.container-item-banner > p {
color: white;
font-size: 23px;
text-shadow: 2px 2px 5px black;
}
#editor {
width: 100%;
resize: vertical;
}
I tried using Developer tools, but I could not figure out why the textarea has extra margins and is too large for the container.