Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

273
Vistas
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 Respuestas
Responde la pregunta

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 Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda