客製化Bootstrap 4的網格系統斷點
P粉696891871
P粉696891871 2023-10-18 23:01:50

我有一個應用程序,其中設計需要分別從桌上型電腦到平板電腦或 xl 到 lg 的 1280 斷點。然而,Bootstrap 本身在 1200 處有 xl 斷點。

我需要全域更改 xl 斷點以進行引導。我是否必須從原始檔重新編譯 Bootstrap 4?

我嘗試在我的 Sass 建置中設定它:

$grid-breakpoints: (
  // Extra small screen / phone
  xs: 0,
  // Small screen / phone
  sm: 576px,
  // Medium screen / tablet
  md: 768px,
  // Large screen / desktop
  lg: 992px,
  // Extra large screen / wide desktop
  xl: 1280px
);

$container-max-widths: (
  sm: 540px,
  md: 720px,
  lg: 960px,
  xl: 1220px
);

但是,全域 xl 的斷點沒有任何變化,它仍然會在 1200px 寬處進行斷點。

P粉696891871
P粉696891871

全部回覆(2)
P粉043566314

更改 $grid-breakpoints 變數就可以正常運作。請記住,您必須匯入 custom.scss 中的 /bootstrapbootstrap/variables,然後在 @import bootstrap 之後。

例如:

$grid-breakpoints: (
  xs: 0,
  sm: 600px,
  md: 800px,
  lg: 1000px,
  xl: 1280px
);

示範:https://codeply.com/go/MlIRhbJYGj

#另請參閱:如何擴充/使用 SASS 修改(自訂)Bootstrap 4

熱門教學
更多>
最新下載
更多>
網站特效
網站源碼
網站素材
前端模板
關於我們 免責聲明 Sitemap
PHP中文網:公益線上PHP培訓,幫助PHP學習者快速成長!