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

134
Vistas
Sort the tags content by mobile & desktop breakpoint

I wonder how can I order my divs basing on mobile and desktop breakpoints. I have:

<div>
    <span> foo </span>
    <span> bar </span>
    <span> baz </span>
</div>

I would like to reach a result in which:

only on mobile breakpoint firstspan & secondspan are on the same line, so:

foobar
baz

and only on desktop breakpoint secondspan & thirdspan are on the same line, so:

foo
barbaz

I usually use Tailwind (but I think this information is irrelevant), I tried with flex, break-line but nothing, I don't understand how to create this code.

about 4 years ago · Juan Pablo Isaza
1 Respuestas
Responde la pregunta

0

To achieve this using tailwindCSS, you can use grid and make col-span responsive.

In below example, firstspan & secondspan are on first line until small breakpoint, and for screen bigger than small, firstspan is alone on its line and secondspan and thirdspan are on the same line.

<link href="https://unpkg.com/tailwindcss@^2/dist/tailwind.min.css" rel="stylesheet">
<div class="grid grid-cols-2">
  <div class="sm:col-span-2">First span</div>
  <div>Second span</div>
  <div>Third span</div>
</div>


Edited after comment from @davide

To have the elements on the same line, the easiest solution would be to repeat the secondspan twice, and use responsive breakpoints with display classes to hide or display it depending on the screen size.

<link href="https://unpkg.com/tailwindcss@^2/dist/tailwind.min.css" rel="stylesheet">
<div>
  <span>First span</span>
  <span class="sm:hidden">Second span</span>
</div>
<div>
  <span class="hidden sm:inline">Second span</span> 
  <span>Third span</span>
</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