简体   繁体   English

为什么我在引导程序中的断点不是好的网格不工作

[英]Why my breaking point in bootstrap is not good grid not working

I don't understand why my breaking point is at 800 px when i ask to be at 991 (lg and lower)in bootstrap 4 here is my code:当我要求在引导程序 4 中达到 991(lg 及更低)时,我不明白为什么我的断点是 800 像素,这是我的代码:

 <div class="container-fluid"> <div class="row"> <div class="col-xl-2 col-lg-6 fondNoir" id="menuTexte"> img</div> <div class="col-xl-2 col-lg-2 fondNoir" id="menuTexte"> Jeux</div> <div class="col-xl-2 col-lg-2 fondNoir" id="menuTexte"> Livres</div> <div class="col-xl-2 col-lg-2 fondNoir" id="menuTexte"> E-sport</div> <div class="col-xl-2 offset-xl-0 col-lg-2 col-md-2 col-sm-2 offset-sm-7 fondNoir" id="menuTexte"> Communauté</div> <div class="col-xl-2 col-lg-2 fondNoir" id="menuTexte"> Boutique</div> </div> </div>

None of your breaking points are at 800px.您的断点都不是 800 像素。 If you see closely, they are working just as you specified them.如果您仔细观察,它们会按照您指定的方式工作。 You need to understand how grid system works in bootstrap.您需要了解网格系统如何在引导程序中工作。

Bootstrap Grid System引导网格系统

Grid breakpoints are based on minimum width media queries, meaning they apply to that one breakpoint and all those above it (eg, .col-sm-4 applies to small, medium, large, and extra large devices, but not the first xs breakpoint).网格断点基于最小宽度媒体查询,这意味着它们适用于该断点及其上方的所有断点(例如,.col-sm-4 适用于小型、中型、大型和超大型设备,但不适用于第一个 xs 断点)。

If nothing is specified for a certain screen size, it will be defaulted to 12 grid size ( you can consider it to be defaulted to col-xs-12 if nothing is specifed)如果没有为某个屏幕尺寸指定任何内容,它将默认为 12 网格大小(如果没有指定,您可以认为它默认为col-xs-12


Working of your Program你的程序的工作

  1. XL Screens: XL 屏幕:

    When your snippet is run on a extra large screen or xl (>1200px), each of the divs take 2 grids worth of space ( col-xl-2 will apply to all).当您的代码片段在超大屏幕或xl (>1200px) 上运行时,每个 div 占用 2 个网格的空间( col-xl-2将适用于所有)。


  1. LG Screens: LG 屏幕:

    When you transition from large screen or lg (992px - 1200px), you have dropped below 1200px and now the col-lg will apply.当您从大屏幕或lg (992px - 1200px) 转换时,您已降至 1200px 以下,现在col-lg将适用。 So the grids will be divided as所以网格将被划分为

    • Divisions -部门 -

    • 1st div - 6 grids ( col-lg-6 ).第一个 div - 6 个网格( col-lg-6 )。

    • 2nd to 4th divs - 2 grids each in first row( col-lg-6 ).第 2 到第 4 个 div - 第一行各有 2 个网格( col-lg-6 )。 Now all 12 grids of 1st row are used.现在使用了第一行的所有 12 个网格。
    • 5th and 6th divs - 2 grids( col-lg-6 ) each in second row.第 5 和第 6 格 - 第二行各有 2 个网格( col-lg-6 )。


  1. MD Screens: MD屏幕:

    When you go below 992px, you enter medium screen range(768px - 992px), the divs will be placed as per col-md or if not specified for range below lg , they will default to col-xs-12 .当您 go 低于 992px 时,您进入中等屏幕范围(768px - 992px),div 将按照col-md放置,或者如果未指定低于lg的范围,它们将默认为col-xs-12 So the grids will be divided as所以网格将被划分为

    • Divisions -部门 -

    • 1st div to 4th divs - 12 grids( defaulted to col-xs-12 since nothing is specifed )第 1 个 div 到第 4 个 div - 12 个网格(默认为col-xs-12 ,因为没有指定任何内容)

    • 5th div - 2 grids offset by 7 ( col-md-2 and offset-sm-7 )第 5 格 - 2 个网格偏移 7( col-md-2offset-sm-7
    • 6th div - 12 grids ( defaulted to col-xs-12 since nothing is specifed )第 6 个 div - 12 个网格(默认为col-xs-12 ,因为没有指定任何内容)


  1. SM Screens: SM 屏幕:

    When you go below 768px, the divs will be given allocated grids just as in case of MD Screens since nothing is specified for sm screens.当 go 低于 768px 时,div 将被分配网格,就像在MD 屏幕的情况下一样,因为没有为 sm 屏幕指定任何内容。


  1. XS Screens: XS 屏幕:

    When you go below 576px, the divs will all remain same except for the 5th div in which case the offset-sm-7 will no longer be applicable and all grids will align to the left occupying 12 grids each.当 go 低于 576px 时,除第 5 个 div 外,所有 div 都将保持不变,在这种情况下, offset-sm-7将不再适用,所有网格将与左侧对齐,每个网格占用 12 个网格。



Hope you understand how your program is working and nothing is going abnormal or unexpected.希望您了解您的程序是如何工作的,并且没有任何异常或意外情况发生。 If you still have any questions, ask in the comments.如果您仍有任何疑问,请在评论中提问。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM