Concealing a column on narrower screens in Bootstrap 4

I always find this aspect of Bootstrap 4 to be particularly confusing.

Imagine you have the following layout:

<div class="container-fluid">
   <div class="row">
     <div class="col-sm-3">col-sm-3</div>
     <div class="col-sm-9">col-sm-9</div>
   </div>
  </div>

Which classes should you assign (most likely to col-sm-3) so that col-sm-3 is hidden on xs, sm, and md screens?

In simpler terms, I want only col-sm-3 to be visible on lg and xl screens.

Answer №1

One way to hide elements on certain screen sizes is by using Bootstrap's display utilities classes. For example:

d-none d-lg-block: will hide the element on screens smaller than lg size

<link href="https://stackpath.bootstrapcdn.com/bootstrap/4.1.1/css/bootstrap.min.css" rel="stylesheet"/>
<div class="container-fluid">     
   <div class="row">
     <div class="col-sm-3 d-none d-lg-block">col-sm-3</div>
     <div class="col-sm-9">col-sm-9</div>
   </div>
  </div>

Similar questions

If you have not found the answer to your question or you are interested in this topic, then look at other similar questions below or use the search

What is the best way to display two tables together using inline styling?

I attempted to display 2 tables inline by setting their display property to inline, but unfortunately, it did not work as expected. Is there a more straightforward way to achieve the desired inline display for these tables? table { display: inline; } ...

Accessing elements from an array and performing addition on those that are numerical

I am trying to figure out how to extract the values from an array created by some code and then combine them into a single variable: var selector = 'input[name^="Textbook"]'; $(selector).on('click', function() { ...

Implementing a permanent class following an incident

Is it possible to dynamically add a class to an element when an event occurs rather than based on a condition? For example, I have a td that displays a variable. <td>{{myVar}}</td>//myVar=10 When the variable changes to myVar=15, I want to ad ...

Combining MarkDown elements into a DIV or a custom HTML tag

I have utilized the Jeykll tool to convert mark down content into HTML. I am looking to group the following mark down elements within a div element or another custom HTML tag. Markdown #Multiple Axis {:.title} Different types of data can be vis ...

In an HTML document, there is a single image visible while another remains hidden

I am facing an issue with displaying two images in HTML. The first image is showing up without any problem, but the second one is not visible. I even tried replacing the second image with a different one from the same path, but it still doesn't show. ...

Removing the pound sign from the URL in location hash

function updateView(category) { console.log( window.location.hash ); if (location.hash !== ""){ //convert #3 to 3. //load video based on id //myArray[sanitizedHash]; } else { updateCategoryLabel(category); currentList = updateVi ...

What is causing the discrepancy between the appearance of my fiddle and my page?

Hey there, I encountered an issue while working on a page using jsFiddle - it seems to be behaving differently when viewed on the actual website! If you want to take a look: http://jsfiddle.net/8Hpmj/8/ http://ktaadn.me/about/ The example at ktaadn.me do ...

Show the modal content in Bootstrap on mobile and tablet screens

I have exhaustively searched the web for a solution to my issue, but unfortunately, I have come up empty-handed. I am hoping that you can offer some guidance in this matter. I am currently utilizing modals to showcase details on my website. However, when ...

Element does not cross both explicit and implicit columns

When working in a grid container with only 1 column and 1 row, if there is an implicit column in the first row, how can an element in the second row (as shown by the green column in the example) span across both the explicit and implicit columns? I appreci ...

Using Javascript within an HTML document may not provide the intended functionality

My script: <!DOCTYPE html> <html> <head> <script> $(document).ready(function () { document.getElementById("saveForm").click(); }); </script> </head> <!--<body onload="document.getElementById('saveForm&apos ...

What is the best method to add an overlay div onto another div when hovered, with a grid-style layout?

I attempted to create a grid-like design where each div would display an overlay on hover. The overlay div includes two buttons that should be centered. Although I believe the logic of my code is correct, the position of the buttons and overlay is not ce ...

Using JQuery to dynamically change className based on specific logic conditions

I am struggling to dynamically change the class name of a div based on the text inside another div using jQuery. Here is an example of the HTML structure: <div class="div-overlay"> <a class="image" href="https://www.e ...

CSS selector targeting the first occurrence of a certain element type across the entire

Struggling to select the first div using CSS :first-of-type and make the styling apply to all. Any suggestions on how to fix this? Check out this example .message:first-of-type { background: purple; } ...

When HTML anchors are placed over thumbnails, they can cause white stripes to appear underneath the

I have organized my thumbnails in an unordered list, but I'm encountering an issue where the anchor tag seems to overlap them, creating white stripes underneath. Below is the code I am currently using: HTML: <div class="wrapper"> & ...

Create HTML code automatically from JSON data

Currently, I am in the process of developing a template system. The concept is that an ordinary user can create a JSON file which will then be used by the system to automatically generate HTML code. However, I am facing some challenges and feeling a bit lo ...

Achieving full width for the elements in a row with Flexbox: A step-by-step guide

I am dealing with a flexbox grid that contains random width images: https://i.stack.imgur.com/pfPeU.jpg I want to stretch the elements in each row to full width to eliminate any white space - Is there a way to achieve this using CSS? justify-content do ...

Avoid the URL colon being converted to %3A

Is it possible to pass a colon from one form to another through a hyperlink without ending up as %3A? It seems like the link keeps converting it to %3A. For instance, currently: Attempting to achieve: current: ...

Issue with the dropdown selection menu

I've been customizing a paid template based on this original design: The dropdown menu is causing issues - it doesn't open on mouseover and requires a click to access. Additionally, once the menu is open, there's a problem with closin ...

The default height setting for React MUI Avatar div is a fixed value of 40 pixels

I am working with a MUI Avatar component in my project: <Avatar sx={{ width: 180, height: "auto", maxHeight: 180, margin: 2 }} variant="square" alt={""} src={ global.config.baseUrl + "/image/logo" ...

When the jQuery Div is moved to the right, it gradually shrinks in size, yet remains unchanged when

I have been making updates to this page, which you can view here. When you select "Let's Get Started" and then proceed with the right arrows, the divs smoothly move to the left without shrinking. However, when clicking on the back or left arrows, the ...