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

200
Visualizações
How to display long sentences as two lines in nextjs

so I'm using Nextjs to code a website, I want my longer text to be displayed as 2 lines

For example this

This is an example

would be like this instead

This is
an example

After some researching I found something, I then added this to my styles.js file but didn't work. Maybe I'm misunderstanding it

exampleClass: {
    fontSize: 13,
    width: '81px',
    display: 'webkit-box',
    WebkitBoxOrient: 'vertical',
    WebkitLineClamp: 2,
    textOverflow: 'ellipsis',
    overflow: 'hidden',
  },

It's been bugging me for awhile now, so any helps would be much appreciated. Thanks

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

0

Welcome to Stackoverflow! This seems to be a straight up HTML/CSS question vs anything to do with NextJS or javascript - you should consider removing the nextjs tag and just tag it as a html/css question. Having said that,

You have several options.

  1. You could add a <br/> tag where you want to get the break. i.e This is an <br/> example
  2. You could wrap the content in a container with a width and set a word-break in CSS , example

<div class="container"> This is an example </div>

where the corresponding CSS could set the width and wrap

In your CSS

.container { width: 100px; word-break:break-all; /* Assuming 100px is what it takes and introduces a line break for you */ }

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