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

221
Visualizações
CodeMirror styles are not working after decorating the textarea

I have a Nuxtjs/Vuejs application within which I have a textarea related to XML/JSON. After the user provides the values for these textarea they will be decorated with XML/JSON using CodeMirror.

Initially, the textarea will have the height of 78vh and I would like my CodeMirror to have the same height and width after making the beautification and include the horizontal/vertical scroll bar to move if the content exceeds the border.

I tried to add the CSS property like this but it's not working at all and I get the huge scroll bar to my browser rather within textarea.

.CodeMirror{
    height: 78vh;
    position: relative;
    overflow: hidden;
    border: 1px solid black;
}

I also tried adding !important and div > div > div > div > div.CodeMirror { to ensure I am taking parent into consideration but nothing seems to work for me.

Can someone please let me know what I need to do so that my textarea will have same height and width and include a horizontal and vertical scrollbar within itself?

I have added my sample code in the CodeSandBox here: https://codesandbox.io/s/boring-water-g14zd?file=/pages/index.vue

about 4 years ago · Juan Pablo Isaza
1 Respostas
Responde à pergunta

0

I added in JS instead of in CSS and that worked for me:

for (const s of document.getElementsByClassName('CodeMirror')) {
        s.style.border = '1px solid black'
      }
about 4 years ago · Juan Pablo Isaza Relatório
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