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

192
Vistas
CSS solution for setting up a condition

I'm using bootstrap to split my blog's homepage posts into 2 columns. In order to avoid one issue (posts badly displayed due to different height, see example here:

enter image description here

I'm defining the article height to 350 pixels (and here you can see it solved:

enter image description here

The problem is this solution causes posts to be displayed one over the other, when visitors are using a small screen (mobile or small tablets).

So I'm currently using a javascript to avoid this, but I think it's not the best solution. Do you know if there's a better CSS method to obtain this same result? (I'm newbie)

Index:

<article class="post col-md-6 main article" id="DeviceScreen">

CSS:

#namisboobs{height:350px;}
#anasboobs{height:auto;}

Header:

<script>
  var el = document.getElementById('DeviceScreen');
    {
    if ($(window).width() < 960)
    { el.innerHTML = (('anasboobs'));
    }
    else { el.innerHTML = 'namisboobs';}
    }
</script>

 

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

0

You can do like this.

.post {
  background-color: green;
}
<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.3.1/css/bootstrap.min.css" integrity="sha384-ggOyR0iXCbMQv3Xipma34MD+dH/1fQ784/j6cY/iJTQUOhcWr7x9JvoRxT2MZw1T" crossorigin="anonymous">

<div class="d-flex flex-wrap justify-content-center">
  <div class="align-self-stretch col-md-6 col-12 post">
    This is sample text.
  </div>
  <div class="align-self-stretch col-md-6 col-12 post">
    This is sample text.<br>
    This is sample text.<br>
    This is sample text.<br>
    This is sample text.<br>
    This is sample text.<br>
    This is sample text.<br>
    This is sample text.<br>
    This is sample text.
  </div>
</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