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

269
Visualizações
How to make stretchable chat bubble in Javascript?

I would like to make stretchable bubble chat shape in Javascript. It should have gradient color as background and possibility to add border around the shape. The result would be something like this:

enter image description here

The rounded part would be stretchable and triangle will stay in middle in same size.

I have tried these approaches:

  1. Draw SVG with clipPaths. Problem here was that triangle was not staying in same shape (it was stretching).

  2. CSS clip-path. Problem here was that I did not manage to draw this kind of shape using basic shapes. unfortunately, clip-path is not supporting multiple clip-path at once.

  3. Draw bubble in canvas and use as background. As bubble should stretch based on content inside, then the issue is to get events when content changed size and trigger redraw for canvas.

For now, canvas approach could be the easiest, but maybe there is some other solutions which I am missing.

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

0

You can use ::after to achieve the result

.message {
  display: inline-block;
  height: 120px;
  width: 130px;
  border-radius: 8px;
  position: relative;
  background: rgb(2, 0, 36);
  background: linear-gradient(10deg, rgba(2, 0, 36, 1) 0%, rgba(9, 9, 121, 1) 35%, rgba(0, 212, 255, 1) 100%);
}

.message::after {
  content: "";
  background-color: black;
  height: 16px;
  width: 16px;
  position: absolute;
  bottom: -4px;
  left: 50%;
  transform: translate(-50%) rotate(45deg);
}
<div class="message"></div>

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