Bootstrap 4 - How to hide a container on laptop and smaller but show it on desktop

孤者浪人 提交于 2020-03-28 06:38:29

问题


I am developing the header of a website. The searchbar looks like this in full hd desktop:

But on laptop view (width: 1280px) it looks like this:

So I try to hide the last column for laptop view and smaller views, but there seems to be no way, since Extra large is defined as >= 1200px and my laptop screen is 1280px width. Why is my tiny laptop screen already considered as "Extra large" ?

Bootstrap claims to be a "mobile first" framework. However, judging from the breakpoints, it's a mobile-only layout framework

Do I have to use media queries and custom css classes to hide it, or is there still a bootstrap 4 way?

https://getbootstrap.com/docs/4.0/layout/grid/


回答1:


You can customize the breakpoints to your liking:

https://getbootstrap.com/docs/4.4/layout/grid/#customizing-the-grid

Adjust the values in the sass to the ones you want / need.

Example:

$grid-breakpoints: (
  xs: 0,
  sm: 600px,
  md: 800px,
  lg: 1000px,
  xl: 1281px // or what ever else you want for extra large
);


来源:https://stackoverflow.com/questions/59753330/bootstrap-4-how-to-hide-a-container-on-laptop-and-smaller-but-show-it-on-deskt

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!