gpt4 book ai didi

css - 我可以为 Bootstrap 3 创建更多 "media min-width"案例吗?

转载 作者:太空宇宙 更新时间:2023-11-04 12:52:00 24 4
gpt4 key购买 nike

Boostrap 3 附带:

@media (min-width: 1200px)
.container {
width: 1170px;
}

@media (min-width: 992px)
.container {
width: 970px;
}

@media (min-width: 768px)
.container {
width: 750px;
}

我可以随意添加更多最小宽度的案例吗?我应该考虑什么?

我希望在 1200px 和 1920px 之间有更多的情况...因为在 1920px 中我最终得到一个 1170px 的容器,这很糟糕,因为它可能是 1300px

最佳答案

事情没有那么简单。 Bootstrap 3 带有 4 个类:

  1. xs(特小)0-768
  2. sm(小)768-992
  3. md(中等)992-1200
  4. lg(大)>1200

并且容器类链接到这个类,所以如果你想在这个宽度之间有其他的stepps,你必须从添加一个新类开始,例如:xxs(超小)0-384(女巫没有在现在启动),你必须添加这个类:

.col-xxs-1, .col-xxs-2, .col-xxs-3, .col-xxs-4,
.col-xxs-5, .col-xxs-6, .col-xxs-7, .col-xxs-8,
.col-xxs-9, .col-xxs-10, .col-xxs-11, .col-xxs-12 {
min-height: 1px;
padding-left: 15px;
padding-right: 15px;
position: relative;
}

@media (max-width: 384px) {
.col-xxs-1,
.col-xxs-2,
.col-xxs-3,
.col-xxs-4,
.col-xxs-5,
.col-xxs-6,
.col-xxs-7,
.col-xxs-8,
.col-xxs-9,
.col-xxs-10,
.col-xxs-11 {
float: left;
}

.col-xxs-1 {
width: 8.333333333333332%;
}

.col-xxs-2 {
width: 16.666666666666664%;
}

.col-xxs-3 {
width: 25%;
}

.col-xxs-4 {
width: 33.33333333333333%;
}

.col-xxs-5 {
width: 41.66666666666667%;
}

.col-xxs-6 {
width: 50%;
}

.col-xxs-7 {
width: 58.333333333333336%;
}

.col-xxs-8 {
width: 66.66666666666666%;
}

.col-xxs-9 {
width: 75%;
}

.col-xxs-10 {
width: 83.33333333333334%;
}

.col-xxs-11 {
width: 91.66666666666666%;
}

.col-xxs-12 {
width: 100%;
}

.col-xxs-push-1 {
left: 8.333333333333332%;
}

.col-xxs-push-2 {
left: 16.666666666666664%;
}

.col-xxs-push-3 {
left: 25%;
}

.col-xss-push-4 {
left: 33.33333333333333%;
}

.col-xxs-push-5 {
left: 41.66666666666667%;
}

.col-xxs-push-6 {
left: 50%;
}

.col-xxs-push-7 {
left: 58.333333333333336%;
}

.col-xxs-push-8 {
left: 66.66666666666666%;
}

.col-xxs-push-9 {
left: 75%;
}

.col-xxs-push-10 {
left: 83.33333333333334%;
}

.col-xxs-push-11 {
left: 91.66666666666666%;
}

.col-xxs-pull-1 {
right: 8.333333333333332%;
}

.col-xxs-pull-2 {
right: 16.666666666666664%;
}

.col-xxs-pull-3 {
right: 25%;
}

.col-xxs-pull-4 {
right: 33.33333333333333%;
}

.col-xxs-pull-5 {
right: 41.66666666666667%;
}

.col-xxs-pull-6 {
right: 50%;
}

.col-xxs-pull-7 {
right: 58.333333333333336%;
}

.col-xxs-pull-8 {
right: 66.66666666666666%;
}

.col-xxs-pull-9 {
right: 75%;
}

.col-xxs-pull-10 {
right: 83.33333333333334%;
}

.col-xxs-pull-11 {
right: 91.66666666666666%;
}

.col-xxs-offset-1 {
margin-left: 8.333333333333332%;
}

.col-xxs-offset-2 {
margin-left: 16.666666666666664%;
}

.col-xxs-offset-3 {
margin-left: 25%;
}

.col-xxs-offset-4 {
margin-left: 33.33333333333333%;
}

.col-xxs-offset-5 {
margin-left: 41.66666666666667%;
}

.col-xxs-offset-6 {
margin-left: 50%;
}

.col-xxs-offset-7 {
margin-left: 58.333333333333336%;
}

.col-xxs-offset-8 {
margin-left: 66.66666666666666%;
}

.col-xxs-offset-9 {
margin-left: 75%;
}

.col-xxs-offset-10 {
margin-left: 83.33333333333334%;
}

.col-xxs-offset-11 {
margin-left: 91.66666666666666%;
}
}

还有你写的容器类:

@media (min-width: 384px)
.container {
width: 372px;
}

如你所见,它非常复杂,如果你非常非常想自定义它,建议不要使用 Bootstrap 。

关于css - 我可以为 Bootstrap 3 创建更多 "media min-width"案例吗?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/26090786/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com