Reputation: 13683
I have a simple row with two columns
<div class="row">
<div class="col-9">
hello
</div>
<div class="col-3">
world
</div>
</div>
However due to the small screens i would like change the column classes if on mobile and so my classes would be
<div class="row">
<div class="col-8">
hello
</div>
<div class="col-4">
world
</div>
</div>
is there a method i can use to switch the classes like this? I am using thymeleaf with spring boot for backend and bootstrap 5 for frontend.
Upvotes: 0
Views: 116
Reputation: 2629
As Kuladeep Surebathina mentioned or ths in comment, you can use Bootstrap breakpoints.
[...] media query classes for 600px and below
According to Customize Bootstrap 4's grid-system Breakpoints accepted answer, you can customize the provided breakpoints.
Upvotes: 1
Reputation: 127
You can use the below method to apply different classes for different screen sizes
<div class="row">
<div class="col-lg-9 col-8">
hello
</div>
<div class="col-lg-3 col-4">
world
</div>
</div>
You can replace the breakpoints based on your screen size requirements
refer to the breakpoints in this link https://getbootstrap.com/docs/5.2/layout/grid/#grid-options
Upvotes: 3