媒体查询和基于Bootstrap的Moodle主题中的页面宽度

huangapple go评论75阅读模式
英文:

Media query and page width in Bootstrap based Moodle theme

问题

I'm using the LMS Moodle 4 and the bootstrap based theme boost (github)

By default the page is very narrow on all screens and I'd like to use the bootstrap approach for different screen sizes (.container)

This is what I tried to use in the raw scss field and also the custom css field:

/* Page Width */
@media screen and (max-width: 575px) { $course-content-maxwidth: 100% !default; }
@media screen and (min-width: 576px) and (max-width: 767px) { $course-content-maxwidth: 540px !default; }
@media screen and (min-width: 768px) and (max-width: 991px) { $course-content-maxwidth: 720px !default; }
@media screen and (min-width: 992px) and (max-width: 1199px) { $course-content-maxwidth: 960px !default; }
@media screen and (min-width: 1200px) and (max-width: 1399px) { $course-content-maxwidth: 1140px !default; }
@media screen and (min-width: 1400px) { $course-content-maxwidth: 1320px !default; }

When I only use

$course-content-maxwidth: 100% !default;

or

$course-content-maxwidth: 1320px !default;

it does work but not the combination with media queries above.

Any idea how I could get it to work?

英文:

I'm using the LMS Moodle 4 and the bootstrap based theme boost (github)

By default the page is very narrow on all screens and I'd like to use the bootstrap approach for different screen sizes (.container)

This is what I tried to use in the raw scss field and also the custom css field:

/* Page Width */
@media screen and (max-width: 575px) { $course-content-maxwidth: 100% !default; }
@media screen and (min-width: 576px) and (max-width: 767px) { $course-content-maxwidth: 540px !default; }
@media screen and (min-width: 768px) and (max-width: 991px) { $course-content-maxwidth: 720px !default; }
@media screen and (min-width: 992px) and (max-width: 1199px) { $course-content-maxwidth: 960px !default; }
@media screen and (min-width: 1200px) and (max-width: 1399px) { $course-content-maxwidth: 1140px !default; }
@media screen and (min-width: 1400px) { $course-content-maxwidth: 1320px !default; }

When I only use

$course-content-maxwidth: 100% !default;

or

$course-content-maxwidth: 1320px !default;

it does work but not the combination with media queries above.

Any idea how I could get it to work?

答案1

得分: 0

不要紧,我错误地使用了变量。当我使用类时它有效:

/* 页面宽度 */
@media screen and (min-width: 576px) and (max-width: 767px) { .pagelayout-standard #page.drawers .main-inner, body.limitedwidth #page.drawers .main-inner { max-width: 540px; }}
@media screen and (min-width: 768px) and (max-width: 991px) { .pagelayout-standard #page.drawers .main-inner, body.limitedwidth #page.drawers .main-inner { max-width: 720px; } }
@media screen and (min-width: 992px) and (max-width: 1199px) { .pagelayout-standard #page.drawers .main-inner, body.limitedwidth #page.drawers .main-inner { max-width: 960px; } }
@media screen and (min-width: 1200px) and (max-width: 1399px) { .pagelayout-standard #page.drawers .main-inner, body.limitedwidth #page.drawers .main-inner { max-width: 1140px; } }
@media screen and (min-width: 1400px) { .pagelayout-standard #page.drawers .main-inner, body.limitedwidth #page.drawers .main-inner { max-width: 1320px; } }
英文:

Nevermind, I used the variable wrong. When I use classes it works:

/* Page Width */
@media screen and (min-width: 576px) and (max-width: 767px) { .pagelayout-standard #page.drawers .main-inner, body.limitedwidth #page.drawers .main-inner { max-width: 540px; }}
@media screen and (min-width: 768px) and (max-width: 991px) { .pagelayout-standard #page.drawers .main-inner, body.limitedwidth #page.drawers .main-inner { max-width: 720px; } }
@media screen and (min-width: 992px) and (max-width: 1199px) { .pagelayout-standard #page.drawers .main-inner, body.limitedwidth #page.drawers .main-inner { max-width: 960px; } }
@media screen and (min-width: 1200px) and (max-width: 1399px) { .pagelayout-standard #page.drawers .main-inner, body.limitedwidth #page.drawers .main-inner { max-width: 1140px; } }
@media screen and (min-width: 1400px) { .pagelayout-standard #page.drawers .main-inner, body.limitedwidth #page.drawers .main-inner { max-width: 1320px; } }

huangapple
  • 本文由 发表于 2023年2月26日 19:25:52
  • 转载请务必保留本文链接:https://go.coder-hub.com/75571645.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定