Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

195
Visualizações
How to disable scroll in <textarea> and expand it according to the text inside parent container?

I am trying to make a notes app, which has textarea and user can add checkboxes and other tools as well (like notion). but I can't combine those all well inside a container.Here's the html for container in which

 <div class="editor">
 <input type="text" class="notes-title" placeholder="Your Title...">
 <div class="text-body">
     <textarea class="notes-body" placeholder="Start writing your notes here..."></textarea>
  </div>
 </div>

This is what I add using insertAdjacentHTML() in JS,

<div class="tool-container">
<input type="checkbox" id="checkbox" value="HTML"><span class="checkmark"></span>
<label for="html"><textarea class="notes-body" placeholder="task..."></textarea></label>
</div>

I want to add the checkbox after the endline of the textarea, but the checkbox is added at the sameplace inside editor, no matter where textarea ends, and if the text area overflows it starts scrolling in the same space rather than expanding. CSS classes

.notes-body{
    flex-shrink: 1;
    line-height: 1.5;
    overflow: visible;
}
.text-body {
    display: flex;
    flex-direction: column;
    font-size: 1.2em;
    line-height: 1.5;
    margin-top: 3px;
    padding: 5px;
    width: 100%;
    height:100%;
}
.tool-container{
    display: flex;
    flex-shrink: 1;
    line-height: 1.5;
    cursor: pointer;
    font-size: 22px;
    -webkit-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
    user-select: none;
}
.tool-container input {
    position: absolute;
    opacity: 0;
    cursor: pointer;
    height: 0;
    width: 0;
  }
  .tool-container .notes-body{
    
    width: 100%;
    height: 100%;
    line-height: 1.5;
}
.tool-bar{
    border-top: solid grey 1px;
    display: flex;
    padding: 3px;
    margin: 5px;
}

Please help me set the textarea such that it expands inside parent container, and the next flex-item (checkbox/img etc) comes right next to it.


about 4 years ago · Juan Pablo Isaza
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda