I just add this as an answer because it is too long for a comment ... which was @Kian's answer.
Since bootstrap [4] is "mobile-first", you start there.
So the question is, “do you want to show this at the XS breakpoint?”:
- If so, then the d- * classes are not needed, as this will be shown in XS and all sizes are larger.
- If not, then do not
d-none .
When you go to the next breakpoint [SM], ask yourself: “Do I want to show this at the breakpoint SM?”.
- If yes, and it shows for XS too, then no change.
- If yes and XS was hidden (with
d-none ), then you need to do d-sm-block . - If not and XS has been shown, then do
d-sm-none . - If not and XS was hidden, then no change.
Rinse-repeat for each breakpoint which is greater if the display property is different from the previous / smaller breakpoint
Here are some examples:
<div class="d-none d-md-block">Show on medium, and bigger, screen sizes</div> <div class="d-md-none">Show on extra small and small screen sizes</div> <div class="d-none d-md-block d-lg-none">Show on ONLY medium screen sizes</div> <div class="d-none d-sm-block d-md-none d-xl-block">Show on ONLY small and extra large screen sizes</div>
Here is the violin
source share