Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

190
Views
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 answers
Answer question

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 Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!