Do you use display classes to responsively hide/show content?

Updated by Brady Stroud [SSW] 1 year ago. See history

123
<introEmbed body={<> When designing responsive websites, it's important to consider what content is appropriate for each screen size. Desktops might have large navigation areas and extra content in a sidebar, whereas the phone might focus on other content. </>} />

By default, Bootstrap will wrap the columns and make them full width on phones. If you want to hide content rather than let it wrap you can use the .d-none class or one of the .d-{sm,md,lg,xl}-none classes for any responsive screen variation.

More information on Display property - Quickly and responsively toggle the display value of components and more with our display utilities.

Image

❌ Figure: Bad Example - The mobile view on the right has a large unnecessary title

Remove the title by adding the .hidden-xs class.

<h1 class="d-xl-none">ASP.NET</h1>
Image

✅ Figure: Good example - The mobile view is now leaner and cleaner thanks to Bootstrap display classes

Acknowledgements

Ben Cull
Related rules

Need help?

SSW Consulting has over 30 years of experience developing awesome software solutions.

We open source.Loving SSW Rules? Star us on GitHub. Star