• [Wébinaire 13 novembre 2025] Comment l’IA optimise la performance marketing in HubSpot ?

    S'inscrire

CMS Development

Ckleming
Participant | Partenaire solutions Platinum
Participant | Partenaire solutions Platinum

Media query for responsive columns

Résolue

Currently finishing my CMS for developers practicum, but I am stuck on one last requirement.

 

"Must be 4 equal columns wide on large screens and 2 equal columns wide on screens below 900px."

 

I have tried different media queries, but can't find the right one.

 

Any tips ?

0 Votes
1 Solution acceptée
DanielSanchez
Solution
Conseiller clé | Partenaire solutions Platinum
Conseiller clé | Partenaire solutions Platinum

Media query for responsive columns

Résolue

Hi @Ckleming 

 

Congratulations on finalizing the certificate. This training is very good!

 

Look how use media query:

 

HTML

<div class="my-column">
   Content here
</div>
<div class="my-column">
   Content here
</div>
<div class="my-column">
   Content here
</div>
<div class="my-column">
   Content here
</div>

 

CSS

.my-column{ 
    width:25%;
}

@media (max-width:900px){
    .my-column{
         width:50%;
    }
}

in this example I ignored all the other CSS formatting, to show only the responsiveness of the media query.

 

Did this post help solve your problem? If so, please mark it as a solution.

Best regards!

Voir la solution dans l'envoi d'origine

4 Réponses
DanielSanchez
Solution
Conseiller clé | Partenaire solutions Platinum
Conseiller clé | Partenaire solutions Platinum

Media query for responsive columns

Résolue

Hi @Ckleming 

 

Congratulations on finalizing the certificate. This training is very good!

 

Look how use media query:

 

HTML

<div class="my-column">
   Content here
</div>
<div class="my-column">
   Content here
</div>
<div class="my-column">
   Content here
</div>
<div class="my-column">
   Content here
</div>

 

CSS

.my-column{ 
    width:25%;
}

@media (max-width:900px){
    .my-column{
         width:50%;
    }
}

in this example I ignored all the other CSS formatting, to show only the responsiveness of the media query.

 

Did this post help solve your problem? If so, please mark it as a solution.

Best regards!

Ckleming
Participant | Partenaire solutions Platinum
Participant | Partenaire solutions Platinum

Media query for responsive columns

Résolue

Thank you @DanielSanchez,.

 

I have tried this media query. I think my main problem is to use it correctly.

My 4 "columns" are made by grouping an image and custom module. Well I actually have 4 on first row + 2 on second row. Not sure how and where to apply the correct css-class and then define that they are 25%. If that makes any sense. 

 

I have sucessfully used media queries on other things.

0 Votes
DanielSanchez
Conseiller clé | Partenaire solutions Platinum
Conseiller clé | Partenaire solutions Platinum

Media query for responsive columns

Résolue
 
I understand. In this case, you need to do 1 CSS training yourself and practice, as it is a mandatory coding to create responsiveness in your projects.

If you want, paste your HTML and CSS code in response, which I help you correct, but it would be important for you to see a video or website explaining about CSS and media query to train and practice until you find out where your code is wrong. This will take you to another level.

The example I sent you above is the application of the media query in the CSS, if you haven't understood it, then I think it's important to train and practice CSS before. He skipped a step.
 
I hope to help and I will be available to answer questions about CSS whenever you need.
 
Did this post help solve your problem? If so, please mark it as a solution.
Best regards!
0 Votes
Ckleming
Participant | Partenaire solutions Platinum
Participant | Partenaire solutions Platinum

Media query for responsive columns

Résolue

I agree @DanielSanchez . I need to be comfortable with all elements.

 

Yes, I am new to CSS, but still, I am nearly there. I have studied alot.

I have applied the div class in html and the media query in my stylesheet, but my columns does the exact opposite of what I need.  I`ll study some more and get it eventually.

 

Thanks anyway.

0 Votes